Firstly, thank you for an absolutely awesome plugin! I was wondering whether it would be possible to display character details based on the currently logged in user, assuming obviously that the user name is a valid character name... I've found the get_currentuserinfo() function but I can't seem to integrate it with the plugin. Thank you in advance!
I could see that this would be a nice addition but I can't see how you would get to choose your region and realm. I'll investigate this and see what I can come up with.
I'm making a guild site, so I could make the region and realm required custom fields on registration, maybe?
I'm not all that familiar with Wordpress so I wasn't sure how custom registration field would work. Would it be better to have a global region/realm/locale set for the site via a configuration screen or would you want it on a per user basis?
Rofl. Stupid Comment & Close button
Would you be doing the custom fields something like this?
Hehe, I was also just hunting for info on it. :) Ideally, I'd like to integrate it with Buddypress, so this is what I found: http://blogcastor.com/extend/codex/how-to-display-buddypress-profile-field-data/
Where will you have the armory stuff shown? On the users profile? If so it looks like the snippet at the bottom of http://codex.buddypress.org/extending-buddypress/tips-tricks/ might be a good starting point.
You can call the wow-armory-character shortcode function directly passing in the details from the users BP profile here or you could use the documentation http://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-profile-data-loop-bp_has_profile/ and construct a custom profile page that has the shortcode function called.
Thank you for the resources! :) Excuse my denseness, but I'm not sure how I'd pass the details from the profile into the shortcode... I'm not familiar with PHP syntax (I really need to update my coding knowledge and extricate myself from legacy systems! >.<)...
http://wp-cms.com/template-development/inserting-wordpress-shortcode-outside-the-loop-in-a-template/ covers the basics with the relevant docs being http://codex.wordpress.org/Function_Reference/do_shortcode
Just construct your shortcode string using the variables you pull out in the profile loop. A bit like
"[wow-armory-character region='eu' realm='terokkar' name='" . $char_name . "']"
Thank you so much; I've got it working! Woot!! :D
Lol, freaking Comment & Close button!! Here's my code:
$charregion = bp_get_profile_field_data( 'field=Region&user_id=' . bp_loggedin_user_id() );
$charrealm = bp_get_profile_field_data( 'field=Realm&user_id=' . bp_loggedin_user_id() );
$charname = bp_get_profile_field_data( 'field=Character Name&user_id=' . bp_loggedin_user_id() );
echo do_shortcode('[armory-character region="' . $charregion . '" realm="' . $charrealm . '" name="' . $charname . '"]');
Sorry if it's horrifically inefficient - it's the first bit of PHP I've ever coded. 😊
Other then closing and opening the <?php ?> brackets in the middle it looks just fine :)
Rofl, how embarrassing... Fixed! :)
When you've got your site all running nicely would you mind if I had a look? I'd like to see the plugin working 'in the wild' especially with BuddyPress. If you don't mind I'd also like to add the code you figured out to the FAQ (you'd get attribution ofc).