Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
Can the Member page be modded?
Avatar
Thorsten B
Member
sp_UserOfflineSmall Offline
Aug 3, 2017 - 10:08 am

This one's a "would be nice to" but understand if it's not possible.

In an effort to enhance the forum for our students I was wondering if we can replace columns on the Member page, specifically "Registered" and "Last Visited":

Capture-1.PNGImage Enlarger

 

I'd like to have "Location" as well as a custom profile field I created included instead. Would that be possible?

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Aug 3, 2017 - 10:43 pm

the members page is controlled by page template like any other page view...  you can adjust the page as you like by editing the members page template in the sp theme  you are using... as always we suggest a child theme or a custom theme before editing it...

by adding display functions, or just simply grabbing wp/sp data and outputting, you can custom what is shown...

Avatar
Thorsten B
Member
sp_UserOfflineSmall Offline
Aug 4, 2017 - 3:22 am

I've read the through the codex again, which is a great resource for WP programmers, but alas I am not a WP programmer (my forte is data science, R, Python etc.), I can't spend a lot of time trying to read myself into it all for a minor change.

I tried adding sp_ProfileShowLocation('', __sp('Location')); to spMembersView.php (custom theme), but it shows up blank. Same for adding sp_CustomProfileFieldsDisplay('Blog Category', $spProfileUser->ID);.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Aug 4, 2017 - 9:20 am

well, you cant use a profile show type function because those are designed for profile view, so the $spProfileUser user object wont be set up...  the user object that will exist here is $spThisMember... 

and then get the data via $spThisMember->location I believe... I think that will exist for your first example...

and then the second, use spThisMember->ID...

Avatar
Thorsten B
Member
sp_UserOfflineSmall Offline
Aug 4, 2017 - 1:19 pm

Got it, thank you so much. I have the custom profile field displaying now and properly formatted.

However, when I do echo $spThisMember->location; it comes up blank. Other options work fine, i.e. echo $spThisMember->lastvisit; displays the last visit date for each member. Attaching screenshots again:

Capture-2.PNGImage Enlarger

 

Capture2.PNGImage Enlarger

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Aug 4, 2017 - 8:16 pm

are you sure they have a location defined in their profile?

if so, its possible the user object for members view is not a full user object... but you can always fill it with the data... before using, try adding this:

$spProfileUser->location = get_user_meta($spProfileUser->ID, 'location', true);

then you should have it available...

Avatar
Thorsten B
Member
sp_UserOfflineSmall Offline
Aug 5, 2017 - 3:57 am

Yes, several students and all the admins have location defined on their profile.

This worked now:

echo $spThisMember->location = get_user_meta($spThisMember->ID, 'location', true);

Thank you again for the help, much appreciated.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Aug 5, 2017 - 9:46 am

you can optimize that a bit to be:

echo get_user_meta($spThisMember->ID, 'location', true);
Avatar
Thorsten B
Member
sp_UserOfflineSmall Offline
Aug 5, 2017 - 9:52 am

Ah ok, thank you so much. Now we have a much more useful member page. Appreciated.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Aug 5, 2017 - 9:57 am

glad to help...

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17362
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625