Please or Register to create posts and topics.

What's the dynamic link for profiles?

Hello.

I’m using a Wordpress theme which has a logged in modal.

I know how to link the “Profile” in BuddyPress and bbpress, but not asgaros.

Could you provide me the correct code for users to access their pertinent asgaros forum profile directly?

Here’s an example of the placeholder links.

function my_custom_lwa_links() {
?>

​<div class="lwa-a"><a href="https://some-link.com">Some Link Title</a></div>​
​​<div class="lwa-a"><a href="https://another-link.com">Some Second Link Title</a></div>​
​​
​<?php
​}​
​add_action( "zeen_logged_in", "my_custom_lwa_links" );

Thanks in advance.

Hey @lexiture,

the structure of the URL of the profile from Asgaros Forum is

https://yourdomain.com/forum/profile/user-nicename

“forum” is the slug of the page where you added the Forum shortcode

“user-nicename” is the nicename of the WordPress user

 

You can get the nicename of the current user by using the following code:

$nicename = wp_get_current_user()->user_nicename;

 

Lexiture has reacted to this post.
Lexiture
Need professional help with Asgaros Forum? Book an appointment with us at domra Web Solutions for setup and customization services. Learn more about our Toolbox for Asgaros Forum plugin to enhance your forum experience.
Quote from qualmy91 on August 11, 2020, 6:07 am

Hey @lexiture,

the structure of the URL of the profile from Asgaros Forum is

https://yourdomain.com/forum/profile/user-nicename

“forum” is the slug of the page where you added the Forum shortcode

“user-nicename” is the nicename of the WordPress user

 

You can get the nicename of the current user by using the following code:

$nicename = wp_get_current_user()->user_nicename;

 

Thanks for your response. The theme author provided me the following code:

 

function my_custom_lwa_links() {
?>
<div class="lwa-a"><?php plugin_function_to_get_dynamic_link(); ?></div>
<div class="lwa-a"><a href="https://another-link.com">Some Second Link Title</a></div>
<?php
}
add_action( "zeen_logged_in", "my_custom_lwa_links" );

plugin_function_to_get_dynamic_link() it’s what I need. Unfortunately when I put

$nicename = wp_get_current_user()->user_nicename;

Nothing happens, is it the function to get the dynamic link?

 

Thanks.

Hey @lexiture,

the given function only returns the nicename, that is part of the link.

The following code will only wok if the slug for your Forum Page is ‘forum’. You have to change this in line 7 if you are using another page for the forum.

function my_custom_lwa_links() {

// Get nicename of current user
$nicename = wp_get_current_user()->user_nicename;

// Generate Profile URL
$profile_url = site_url() . '/forum/profile/'. $nicename;

echo '<div class="lwa-a"><a href="'. $profile_url .'"></a></div>';

// Add another link by using the echo function
// echo '<<Link>>';
echo '<div class="lwa-a"><a href="https://another-link.com">Some Second Link Title</a></div>';
    
}
add_action( "zeen_logged_in", "my_custom_lwa_links" );

 

Asgaros and Lexiture have reacted to this post.
AsgarosLexiture
Need professional help with Asgaros Forum? Book an appointment with us at domra Web Solutions for setup and customization services. Learn more about our Toolbox for Asgaros Forum plugin to enhance your forum experience.
Quote from qualmy91 on August 13, 2020, 5:42 am

Hey @lexiture,

the given function only returns the nicename, that is part of the link.

The following code will only wok if the slug for your Forum Page is ‘forum’. You have to change this in line 7 if you are using another page for the forum.

function my_custom_lwa_links() {

// Get nicename of current user
$nicename = wp_get_current_user()->user_nicename;

// Generate Profile URL
$profile_url = site_url() . '/forum/profile/'. $nicename;

echo '<div class="lwa-a"><a href="'. $profile_url .'"></a></div>';

// Add another link by using the echo function
// echo '<<Link>>';
echo '<div class="lwa-a"><a href="https://another-link.com">Some Second Link Title</a></div>';
    
}
add_action( "zeen_logged_in", "my_custom_lwa_links" );

 

Thank you. It works.

qualmy91 has reacted to this post.
qualmy91