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
Update "remote avatar" field via another plugin
Avatar
Graham Freeman
Rookie
Free Members
sp_UserOfflineSmall Offline
May 13, 2014 - 2:10 am

I'm using a plugin called wpallimport which pulls XML data and maps it onto posts, pages and users.

It can map onto other plugins fields if those plugins have meta-data or a custom field that's available globally. It looks like S:P doesn't have anything that wpallimport can use.

I have dozens of users I am trying to import into S:P, and their avatars are all external and all take the form of http://somedomain/username.jpg

wpallimport creates their userid, name, password etc on the WP site, all fed from the XML data. The only thing it can't do, is create the external avatar link in S:P

I hope I made that clear enough to have a crack at solving this,

Thanks

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
May 13, 2014 - 7:20 am

not entirely sure what you are trying to accomplish... wp in general does not support remote avatars...  it does support gravatars and other fixed avatars but not like the url you have specified... however if if this plugin of yours uses the wp api for avatars (there is a wp function for getting users avatar), we can support it too... there is an option on forum - profiles - avatars in the avatar priority to use the wp avatar vice a simple press avatar...

if you are not using the wp avatar api, then you would have to get the remote avatar information stored into the sfmembers table of the db (and enable remote avatars) and simple press can use it...  but there is no UI per se to accomplish the importing of this remote urls...

Avatar
Graham Freeman
Rookie
Free Members
sp_UserOfflineSmall Offline
May 13, 2014 - 10:31 am

It's not the other plugin that's using the wp api for avatars - sp is the plugin that allows the remote avatar information to be added by the user. 

In the admin screen for sp you can specify this to be allowed, and for it to be the highest priority of avatar to be used by sp. The option is in PROFILES >> AVATARS >> ENABLE REMOTE AVATARS and I have made sure that the 'remote avatar' priority is the highest on the right hand side of that screen.

Now, my question is - how do I, as an admin, populate that field for all users with the (without quotes) text: "http://image.somesite.com/blah/username.jpg" where username is the wp username in each case?

I could ask all the users to go to their sp front page, click "Profile", click "Edit Avatar", and then enter the exact correct URL in the sp field labelled "Enter the URL for the remote avatar." and then click Save Remote Avatar .... but to get ALL of the users to do that immediately (so other users can see their pic), AND get them to enter it without error ... I'd rather herd cats 🙂 

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
May 13, 2014 - 4:43 pm

you will have to do it programatically... that is bit of php code and mysql query...  this is because the user avatar info is stored as part of a serialized array so the exact value is dependent on url length...

you will need to execute some code like:

foreach ($users as $user) {
    $avatar = sp_get_member_item($user->ID, 'avatar');
    $avatar['remote'] = $avatar_url;
    sp_update_member_item($user->ID, 'avatar', $avatar);    
}

where $users is assumed to be an array of wp user objects... the real goal is for every user in your wp db, to loop through the 3 lines of code to save their avatar url....  the $avatar_url variable is the remote url to their avatar...

does that 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: 620
Members: 17365
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626