Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Multisite user meta - need meta section added to user profile WordPress

  • REFUNDED

<strong>Overview</strong>

I have a multi site running about 8+ website. See screenshot below...

[[LINK href="http://i.imgur.com/EvUccv7.jpg"]]http://i.imgur.com/EvUccv7.jpg[[/LINK]]

I am running 2 themes...

<strong>Theme 1</strong> - mysite.com
<strong>Theme 2</strong> - one.mysite.com, two.mysite.com, three.mysite.com, four.mysite.com, etc

I am accepting user registrations via Theme 1. This site is not locked from the public.

Theme 2 will be locked down from the public via this function in Theme 2's functions.php ...


add_action('get_header', 'wpq_member_only_site');
function wpq_member_only_site() {
// logged in users or visits to a specified page are allowed
if ( !is_user_logged_in() ) {
$redirect_after_login = get_home_url();
// the URL where login/registration takes place
$login_url = wp_login_url( $redirect_after_login );
// redirect visitors
wp_redirect( $login_url, 302 );
exit;
}
}


When a user registers on Theme 1, they are automatically are a Subscriber user on Theme 1.

This is fine.

But I need give users specific access privileges to the multisites which use Theme 2.

This access privilege role will be the same as original. 'Subscriber'


<strong>The Brief</strong>

I need a function in my Theme 1 functions.php which displays a user meta meta section like this within the user profile...

[[LINK href="http://i.imgur.com/B2rFppN.jpg"]]http://i.imgur.com/B2rFppN.jpg[[/LINK]]

These meta boxes should only be visible if the current user is an Administrator.

I need these meta tick boxes to be automatically generated via a loop that get all the sites that are currently public on the network. So if I add more sites in the future, then these meta tick boxes automatically update.

The tick box also needs to populate my <strong>wp_usermeta</strong> table with this...

user_id = <strong>(current user id number)</strong>
meta_key = wp_<strong>(network site ID)</strong>_capabilities
meta_value = a:1:{s:10:"<strong>(current user role)</strong>";b:


Please see the meta code layout I wish to have in my User Profile.

[[LINK href="https://gist.github.com/jcranny/4771584"]]https://gist.github.com/jcranny/4771584[[/LINK]]


I think by doing the above it should successfully grant user access to other multisites with out the use of a plugin.


Developer who supplies working code that I use with get the full prize amount.


Please contact me with any questions.


Thanks in advance.
Josh





Answers (1)

2013-02-12

Fahad Murtaza answers:

Hello Josh

I can work on this. WIll take me a day. Please check your personal messages.