Button to "my course" page

Home Forums Legacy Support Support queries How-to & Troubleshooting Button to "my course" page

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #222474
    dav80
    Spectator
    Hello,   Is it a way to create a button allow to redirect to the My Course page ?   Thanks
    #222545
    Diana
    Participant
    @dav80 Where do you want to add this button. Please share a screenshot
    #222565
    dav80
    Spectator
    Hello, We need to create a button on the home page. We force login to access to the home page. So i need to retrieve the username of the current user to insert this variable into the url button as below : https://myurl/all-courses/USER/course/ But i don't know how to retrive dynamically the USER variable.   Pending read  
    #222738
    logan
    Member
    Hello, yes that is possible, i will try to create a shortcode then that will fetch the current user detail but I need some answers:
    1. do you want to add the button by elementor or any page builder??
    2. the styling of page builder won't apply on this button.
    3. tell me the exact styling of the button and place so that i can write specific codes.
    #222757
    dav80
    Spectator
    Hello, 1.Yes i can use elementor or code directly. 2.No problem 3.Green button, rounded. I will personnalised it.   Thanks
    #222836
    logan
    Member
    Hello, refer this: http://somup.com/cqjqjaeZcg Please paste this snippets in your wp-admin >> plugins >> editor >> wplms-customizer plugin >> wplms-customizer.php  Or in Please add this code in your wplms-customizer.php file in wplms customizer plugin by using your FTP/SFTP/cpanel: add_shortcode('button_to_my_course',function (){ ?> <style> a.logan_button_to_my_course { background: green; padding: 10px 25px; border-radius: 10px; color: white; </style> <?php $current_user = wp_get_current_user(); $username = $current_user->user_login; $url= get_home_url().'/members/'.$username.'/course'; return "<a href='$url' class='logan_button_to_my_course'> My Courses </a>"; }); use shortcode [button_to_my_course]
    #222845
    dav80
    Spectator
    Hello,   Thank you for this code. The code works but i have a problem with usernamue wich contains space. When user name contain space à %20 is added in the url instead of the space. But we need a - instead of %20 to allow good redirection. With a %20 it generated a 404 error. In the url we need to replace space by - Is it a way to make this change ? Thanks
    #222852
    logan
    Member
    try this: Please add this code in your wplms-customizer.php file in wplms customizer plugin by using your FTP/SFTP/cpanel: add_shortcode('button_to_my_course',function (){ ?> <style> a.logan_button_to_my_course { background: green; padding: 10px 25px; border-radius: 10px; color: white; </style> <?php $current_user = wp_get_current_user(); $username = urlencode($current_user->user_login); $url= get_home_url().'/members/'.$username.'/course'; return "<a href='$url' class='logan_button_to_my_course'> My Courses </a>"; });
    #222854
    dav80
    Spectator
    This change replace the %20 by a + instead of a - Any idea ?
    #222987
    logan
    Member
    Hello, try this code. add_shortcode('button_to_my_course',function (){ ?> <style> a.logan_button_to_my_course { background: green; padding: 10px 25px; border-radius: 10px; color: white; </style> <?php $url= bp_core_get_user_domain(get_current_user_id()).'course'; return "<a href='$url' class='logan_button_to_my_course'> My course button </a>"; });
    #222990
    dav80
    Spectator
    Hello,   It's works like a charm !   Thank you.
    #222996
    logan
    Member

    Friend,

    for all my efforts, i hope you wouldn't mind writing a detailed review about your experience with WPLMS and our customer support.

    Here: https://themeforest.net/item/wplms-learning-management-system/reviews/6780226

    If I can be of assistance, please do not hesitate to contact me again.

    Closing this topic. best regards friend.

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Button to "my course" page’ is closed to new replies.