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
Need To Nuke Some Items on Profile Edit Page
Avatar
GrantSwaim
Member
Free Members
sp_UserOfflineSmall Offline
Nov 15, 2011 - 9:59 pm
I am getting 5.0 in pretty good shape. One more tweak and I think it is gonna be a keeper 🙂

I would like to remove Login Name, Display Name, First Name, Last Name from the Edit Profile Page. I looked at the only template file that seemed to relate to this (spProfleEdit) but it didn't have these items listed anywhere.

Any ideas before I go exploring and break something ?

 

Thanks in advance for any help on this.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Nov 15, 2011 - 11:17 pm

thanks for the kind words on 5.0!

telling you how to do this would be a lot easier when we get our codex documents in place... wink

actually, that isnt the page you want...  and you dont want to change the core code... the new api lets your remove things just like in wp with filters...  you can see the available filters in the codex, but they are not fully defined...  so the file is sp-form-profile.php, but we dont want to edit it - only look at it for the filters we want to use to remove stuff... 

but not sure why you want to remove those items...  they are information only.. and you can disable users from changing their display name on forum - profiles - profile options...   and they already cannot change their login name - just view it which they already know since they logged in...  and this is the profile edit page, so its not visible to other users anyways...

but if you want to remove from the edit profile page, lets start with an example - the login name...  in that code, around line 50 you will see it displayed (actually just stored in temp variable)...  a couple of lines later you will see an apply_filters() function call... this lets you change what gets output...  in this case, remove...

so...  in your functions.php in the sp theme, you would do something like this:

add_filter('sph_ProfileUserLoginName', 'myremovelogin');
function myremovelogin($out) {
    return '';
}

this will now remove the login name from the edit profile page...  the add_filter() function says when sp fires the hook sph_ProfileUserLoginName, call my function myremovelogin() and execute my code... in this code, replace the existing output with an empty string - which removes from the form...  the things you could do there are pretty much limitless...

and then repeat for the other filters on the profile items: sph_ProfileUserDisplayName, sph_ProfileUserFirstName, sph_ProfileUserLastName obviously adding a new function name in the add_filter() for each...

this may seem strange and a bit odd to get used to, but its the standard wp api and way of doing things...

and will be easier to do than looking through code when we get our codex populated... all hooks/actions/filters will be documented so you can see what is possible...

Avatar
GrantSwaim
Member
Free Members
sp_UserOfflineSmall Offline
Nov 16, 2011 - 2:19 pm

Mr Papa said

...but not sure why you want to remove those items...  they are information only.. and you can disable users from changing their display name on forum - profiles - profile options...   and they already cannot change their login name - just view it which they already know since they logged in...  and this is the profile edit page, so its not visible to other users anyways...

 

I use a membership script (aMember) to push user info to WordPress, but anything changed in WP doesn't sync back to the script. It works fine as long as all changes are made on the aMember side. I provide an aMember sidebar widget on the homepage where they can change their profile info.

I just get paranoid about letting users change WP info outside of aMember. I could disable the "Edit Profile" tab through settings but I want them to be able to edit and add the profile info that is being supported by the SimplePress software (location, website, bio, and any other custom fields that are added).

Thanks for the detailed information on how to filter those items.

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: 617
Members: 17359
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10125
Posts: 79620