Hi... searched for this issue but couldn't find any other similar report and didn't want to bury this in my existing theme customization topic.
I have attempted to add the following supporter_hide_ads script to my wpmu-nelo-child footer and the ad content does not display for any user or visitor.
<?php
if (supporter_hide_ads()) {
//do not show ads
} else {
//show ads
?>
ad content goes here
<?php
}
?>
Can someone please confirm compatibility? Or perhaps provide some direction for troubleshooting? The exact same code works perfectly with other themes we tested, and the adsense code alone without the wrapper displays the ad.
Thanks!
PS: Nelo is most current version, and I have confirmed all supporter files are in the proper locations.
Hi... searched for this issue but couldn't find any other similar report and didn't want to bury this in my existing theme customization topic.
I have attempted to add the following supporter_hide_ads script to my wpmu-nelo-child footer and the ad content does not display for any user or visitor.
<?php
if (supporter_hide_ads()) {
//do not show ads
} else {
//show ads
?>
ad content goes here
<?php
}
?>
Can someone please confirm compatibility? Or perhaps provide some direction for troubleshooting? The exact same code works perfectly with other themes we tested, and the adsense code alone without the wrapper displays the ad.
Thanks!
PS: Nelo is most current version, and I have confirmed all supporter files are in the proper locations.
Just wanted to clarify, this is for the main blog... realizing now I may need to use is_supporter_user instead, but I really don't like that bit about it being resource intensive.
What would be the best way to hide ads for Supporters of a blog with thousands of users?
I apologize if I mistakenly reported this as a bug.
The check should actually be against is_supporter.
Nothing in the error logs, and the only function I tried wrapping around the ad content was the one above. Obviously the wrong check.
Will try the is_supporter_user check included in the Supporter plugin install file, assuming that's what you're referring to. If not, please advise.
I'm also still leery about the "resource intensive" notice. We are currently overhauling our theme to minimize calls, and troubleshooting performance issues. We're at 2000+ users and growing, with a steadily increasing Supporter base. Thanks for the reply.
It seems your misunderstanding supporter. Ads never show because you are putting them on the main blog (which is supporter). Supporter is per blog, there technically is no such thing as a supporter user. It's just whether or not the current blog is premium or not.
if you want to control ads on the front end blog per user then is_supporter_user() may work
Right, that was my understanding, and I attempt to try it – so Supporter Users will not see ads throughout the main blog. Just looking for some clarification about just what "resource intensive" may mean on a site with 2000+ users and a growing Supporter base.
It's really not TOO resource intensive.Here is the code: $results = $wpdb->get_results("SELECT * FROM$wpdb->usermetaWHEREuser_id= $user_id ANDmeta_key` LIKE 'wp_%_capabilities'");
foreach ($results as $row) {
$tmp = explode('_', $row->meta_key);
//skip main blog
if ($tmp[1] != $current_site->blogid)
$blog_ids[] = $tmp[1];
}
$blog_ids = implode(',',$blog_ids);
$count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->base_prefix . "supporters WHERE expire > '" . time() . "' AND blog_id IN ($blog_ids)");`
It's cached for 10 minutes, and really shouldn't cause an issue unless you have many users who are members of a large list of blogs.
As it is, it appears this won't work for us anyway. We automatically make all new users members of the main blog – which is a Supporter blog. This makes them instant members of our Forums (SimplePress). Thanks again.
Responses (8)
Member — 31st December 2010 (1 year ago) #
Just wanted to clarify, this is for the main blog... realizing now I may need to use is_supporter_user instead, but I really don't like that bit about it being resource intensive.
What would be the best way to hide ads for Supporters of a blog with thousands of users?
I apologize if I mistakenly reported this as a bug.
Keeper of the Dark Chocolate — 31st December 2010 (1 year ago) #
The check should actually be against is_supporter. If you;re using a different function call to check, have you added in this code somewhere?
And anything in your webserver's error logs when you try this?
Member — 31st December 2010 (1 year ago) #
Nothing in the error logs, and the only function I tried wrapping around the ad content was the one above. Obviously the wrong check.
Will try the is_supporter_user check included in the Supporter plugin install file, assuming that's what you're referring to. If not, please advise.
I'm also still leery about the "resource intensive" notice. We are currently overhauling our theme to minimize calls, and troubleshooting performance issues. We're at 2000+ users and growing, with a steadily increasing Supporter base. Thanks for the reply.
Lead Developer — 2nd January 2011 (1 year ago) #
It seems your misunderstanding supporter. Ads never show because you are putting them on the main blog (which is supporter). Supporter is per blog, there technically is no such thing as a supporter user. It's just whether or not the current blog is premium or not.
Lead Developer — 2nd January 2011 (1 year ago) #
Note if you want to control ads on the front end blog per user then is_supporter_user() may work for you.
Member — 2nd January 2011 (1 year ago) #
Right, that was my understanding, and I attempt to try it – so Supporter Users will not see ads throughout the main blog. Just looking for some clarification about just what "resource intensive" may mean on a site with 2000+ users and a growing Supporter base.
Thanks.
Lead Developer — 3rd January 2011 (1 year ago) #
It's really not TOO resource intensive.Here is the code:
$results = $wpdb->get_results("SELECT * FROM$wpdb->usermetaWHEREuser_id= $user_id ANDmeta_key` LIKE 'wp_%_capabilities'");foreach ($results as $row) {
$tmp = explode('_', $row->meta_key);
//skip main blog
if ($tmp[1] != $current_site->blogid)
$blog_ids[] = $tmp[1];
}
$blog_ids = implode(',',$blog_ids);
$count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->base_prefix . "supporters WHERE expire > '" . time() . "' AND blog_id IN ($blog_ids)");`
It's cached for 10 minutes, and really shouldn't cause an issue unless you have many users who are members of a large list of blogs.
Member — 3rd January 2011 (1 year ago) #
As it is, it appears this won't work for us anyway. We automatically make all new users members of the main blog – which is a Supporter blog. This makes them instant members of our Forums (SimplePress). Thanks again.
Become a member