AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

AI Assistant
Notifications
Clear all

[Closed] Current Logged-in User ID

10 Posts
4 Users
1 Reactions
5,014 Views
Posts: 9
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@darkness)
Active Member
Joined: 7 years ago
[#9324]

where do I add this code to show the active users profile? I've embed [wpforo item="profile" id="25"] its only showing my Profile page

Global $wpforo;
$current_user_id = get_current_user_id();
if( $current_user_id ) $forum_profile_url = $wpforo->member->get_profile_url( $current_user_id );   

9 Replies
Robert
Posts: 10733
Admin
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@robert)
Support Team
Joined: 2 months ago

Hi @darkness,

As far as i see. You don't need any code to get current user profile URLs, just use those URLs without specific user nickname and it'll automatically open current user profile pages:

 


5 Replies
(@darkness)
Joined: 7 years ago

Active Member
Posts: 9
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@robert

Sorry I don't think you understand what I mean. I'm using the shortcode [wpforo item="profile" id="25"]  But I want it to load up the CURRENT user rather then a specific one. I want to do something like [wpforo item="profile" id="$user_id"] 


Robert
Admin
(@robert)
Joined: 2 months ago

Support Team
Posts: 10733
Robert
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@darkness

Ok, I see you now. I'll try to find some solution for you...


(@darkness)
Joined: 7 years ago

Active Member
Posts: 9
Robert
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@robert

that would be great thank you! sorry it didn't make any sense the first time.


(@darkness)
Joined: 7 years ago

Active Member
Posts: 9
Robert
Robert
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

moved to a different plugin because of no solution and doesn't meet my needs... Pretty stupid code to make a shortcode with only a specific user ID.. 


Robert
Admin
(@robert)
Joined: 2 months ago

Support Team
Posts: 10733
Robert
Robert
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@darkness

Sorry to hear that. We've already started working on the current user shortcodes. So I hope you'll have an opportunity use it in future.

Thank you for trying wpForo!


Posts: 533
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@central4allgmail-com)
Prominent Member
Joined: 8 years ago

do you want to show all online users ?


2 Replies
(@darkness)
Joined: 7 years ago

Active Member
Posts: 9
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@central4allgmail-com

no all I wanted to do was make the shortcode [wpforo item="profile" id="25"] get the current user rather then a specific one. Something like [wpforo item="profile" id="$user_id"] 


Sofy
 Sofy
Admin
(@sofy)
Joined: 8 years ago

Support Team
Posts: 5774
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@darkness

Please follow the steps: 

1. open the wp-content/plugins/wpforo/wpforo.php file 

2. find the following line

public function init_shortcode_page(){ 

3. put the code below before this line if( $args['id'] || $args['slug'] ){

if( $args['item'] === 'profile' && !$args['id'] ) $args['id'] = $this->current_userid;

Then just use the following shortcode:

[wpforo item="profile"]

Share: