Atlanta
Supreme Deity
Gunning for gold!
Lifetime member
Member Likes (0)
I created a new role subscriber2. It has the identical capabilities of subscriber but I need the differentiation for different plugins to work.
I only want a subscriber2 role of the CURRENT SITE- to be able to see the Marketpress shopping cart that is hard coded at the top of the framemarket theme because I do not have global cart enabled and it confuses buyers. I pasted this in to gridmarket's header.php:
<div id="header-wrapper">
<div id="header">
<?php
if (current_user_can('read'))
{?>
<?php if ( class_exists( 'MarketPress' ) ) {
$settings = get_option('mp_settings');
if (!$settings['disable_cart']) {
?>
<div id="cart-contents"><?php _e( 'Cart:', 'framemarket' ) ?> <span><?php echo sprintf(__('%s item(s)', 'framemarket' ), mp_items_count_in_cart()); ?></span></div>
<div id="mp-cartsmall">
<div id="toggle">
<?php _e( 'View Cart', 'framemarket' ) ?>
<?php _e( 'Hide Cart', 'framemarket' ) ?>
<?php
}?>
</div>
</div>
1) But subscribers from other blogs can see the cart and I don't want them to unless they are subscribers of the current blog. What code should I be using?
2) it is a paste of code from elsewhere:) Did I insert it the statements properly ?
Thanks!

Responses (17)
Inactive (joined February 2012) Likes (0)
Hey Atlanta,
What you are using here is if (current_user_can('read')), which means if the user can just read the blog (which everyone can), he wold see it.
You should be using if (current_user_can('subscriber2')). subscriber2 is only for the current blog, right?
Let me know how that goes. Good luck!
DEV Diva (joined February 2012) Likes (0)
Hi @Atlanta
We haven't heard back from you, so I'm hoping you got sorted.
I will go ahead and resolve this topic, but please don't hesitate to reopen it should you still require additional support from us. Just select the 'Mark as Not Resolved (re-open)' box below the post area (otherwise we might miss your new post).
All the best!
Gina
Member (joined March 2011) Likes (0)
Paul gave me this solution in live chat today. He said to create a new role with a new capability, eg mp_read and then change header.php in gridmarket to reflect the role's capabilities using user role editor capsman.
He created this pastebin code
http://pastebin.com/WbfSezVa
The change is from
<?php if ( class_exists( 'MarketPress' ) ) {
to
<?php if ((current_user_can('mp_view') && ( class_exists( 'MarketPress' ) )) {
I get the white screen of death when I insert the code so I think that I am missing the closing tags or something.. can you tell me what is wrong with the code?
Inactive (joined February 2012) Likes (0)
Hey @Atlanta
Change that to:
Not 100% sure what @PaulM intended, but think it should work.
Member (joined February 2012) Likes (0)
Hello @Elite Atlanta and @Arun I've discovered through much trial and mostly error that the majority of time when you encounter the white screen of death. The problem is usually not enough memory allocated from your server. Depending on which hosting company you have you may be ablel to do this yourself.
From your Cpanel or virtualmin panel you need to go to php resources and increase the memory there. I just increased mine to 128 just to avoid having to readjust as my website is closer to completion or if I'm trying out other things.
If you don't see the setting or can't adjust it yourself you can contact your hosting company and have them do it for you.
I honestly don't recall if you need to make this same adjustment in the php.ininfile or not, I just know that as soon as I increased it on my server all of my white screen issues went away.
Hopw this helps.
Developer (joined January 2012) Likes (1)Liked by: 
@Dean Kaus, actually the simpler solution for the white screen is to FTP into your site edit the wp-config.php and enable WP_DEBUG to true.
define('WP_DEBUG', true);
By default this is set yo false and should be set to false on production sites as this will hide PHP warnings and errors. And because these PHP warnings/error are now hidden you get the blank screen.
When you enable the WP_DEBUG you will then be shown the warning/error. It could be the memory limit issue. Of some other programming bug or plugin conflicts.
Inactive (joined February 2012) Likes (1)Liked by: 
Hey @Dean Kaus
Am no super expert on this topic, but you don't have access to php.ini on a shared hosting. But if you do have, that is the way to go I think.
You could try this first: http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP
If that doesn't work, increase it via your cpanel and if you don't have access to editing php.ini, you can contact your host :)
Member (joined March 2011) Likes (0)
Thanks. @ Arun should it be
<?php if ((current_user_can('mp_view') && ( class_exists( 'MarketPress' ) ))
or
<?php if ((current_user_can('mp_view') && ( class_exists( 'MarketPress' ) )){
Member (joined March 2011) Likes (0)
This is the error message from the debug tip
unexpected T_VARIABLE in /mysite.com/wp-content/themes/gridmarket/header.php on line 23
This is my code http://pastebin.com/NVjmyNFV
line 23 is
$settings = get_option('mp_settings');
Developer (joined January 2012) Likes (0)
@Atlanta, it looks like you minded the opening '{' on the if statement
if ((current_user_can('mp_view') && ( class_exists( 'MarketPress' ) ))
Developer (joined January 2012) Likes (0)
@Arun, you are correct. There are many options within the WordPress wp-config.php to override some of the default hosting variables.
Member (joined March 2011) Likes (0)
@PaulM
it looks like you minded the opening '{' on the if statement
Sorry, I don't know what minded means. So what is the correct way to do it?
Developer (joined January 2012) Likes (0)
Sorry. minded should read 'missing'. http://pastebin.com/F0AHj0Nz
Member (joined March 2011) Likes (0)
Thanks, I still can't get it to work.
If I use
if ((current_user_can('mp_view') && ( class_exists( 'MarketPress' ) )) {
then I get
unexpected { error message.
If I leave out the { and have 3 )))
then I get
syntax error, unexpected T_VARIABLE in /wp/content/themes/gridmarket/header.php on line 23 error message
If I try 4 )))) instead of 3 then I get
Parse error: syntax error, unexpected '}' in /wp-content/themes/gridmarket/header.php on line 48
Suggestions?
Member (joined March 2011) Likes (0)
Okay, it was )))){
Developer (joined January 2012) Likes (0)
@Atlanta, looks like you have this sorted. Keep in mind that you were providing the error message but posting only a partial set of code to paste bin. It is always easier to have the entire file.
Inactive (joined February 2012) Likes (0)
Hey Paul, Thanks for taking care of this :)
Become a member