alanft
Forum Replies Created
-
Forum: Plugins
In reply to: [Widget Logic] Widget Logic Not SavingYou say “one of your widgets” has this problem. What code do you use in other widgets that’s saving OK. Does the same code (the is_page… code) work in other widgets?
Forum: Plugins
In reply to: [Widget Logic] Widget Logic overwrites existing CSS classesI’ve come across reference to this eg here
http://wordpress.org/support/topic/widget-logic-and-kc-widget-enhancements-conflict
where the KCWE developer says he will add code to detect how WL works. However I’ve resolved to get off my lazy coder behind at last and update the WL code if there is a more general problem that I’m causing with WL.
Forum: Plugins
In reply to: [Widget Logic] Widget Logic overwrites existing CSS classesISTR coming across some clash with KC Widget Enhancements before – so it’s not that Widget Logic overwrites those CSS classes, it’s that WL clashes somehow with how KCWE adds them in the first place.
I don’t know KCWE well enough to answer, sorry.
Also, I don’t really understand the purpose of a plugin to add CSS classes to widgets, as by default WP will add classes and IDs enough to style as you please anyway. eg on the blog i admin, all widgets have the class “widget” and all text widgets also have the class “widget_text” too. In addition the ID of each text widget, eg “text-123456”, singles out a specific text widget, and so on for all widgets (not just text).
no it doesn’t. where were you thinking of adding that?
widget logic code needs to return TRUE or FALSE so change it to something like:
$current_user = wp_get_current_user(); return isset( $current_user->groups[ 9 ] );(note final semi-colon is essential)
for the widget logic just use
current_user_can( ‘role’ )
Forum: Plugins
In reply to: [Widget Logic] [Plugin: Widget Logic] is_active_sidebar() doesn't workI am a lazy lazy coder. also very conservative. If I get time to update I’ll look at a beta that includes this alternative approach and see what sort of reaction it gets – I’m just wary of breaking lots of sites, to the point where I’d consider having *both* approaches in and a setting to toggle between them to maximise compatibility.
as you can see I’m basically making excuses to do nothing. sorry. never say never though. i’ll take a look at that pastbin code – and again thanks to the original contributor and everyone else who’s chipped in.
Forum: Plugins
In reply to: Widget Logic / Widget Context replacing callbackWould you mind giving a slightly longer explanation of the issue. cheers.
Forum: Plugins
In reply to: Show Widget depending on user Grouprole scoper’s documentation seems quiet on this, but a quick look through the code I can see code like
$user_groups = WP_Scoped_User::get_groups_for_user( );
which combined with wp_get_current_user http://codex.wordpress.org/Function_Reference/wp_get_current_user
should get you what you want, though I think the $user_groups array you get back is an array of group IDs which may not be super helpful. Anyway, here’s my untested code example:
$current_user = wp_get_current_user(); if (0==$current_user->ID ) return false; $user_groups = WP_Scoped_User::get_groups_for_user( $current_user->ID ); return in_array([group_id_to_test], $user_groups));while widget logic can in principle modify the content of a widget (using the widget content filter) it is not something that extends very easily to the sort of function you are after. You should contact the widget creator with that suggestion or look for an alternative widget that has that option.
Forum: Plugins
In reply to: [Widget Logic] Widget logic security?When I first released WL I worried about the simple eval. Since then I took out the warning in the read me as it seemed to worry no one.
And that’s largely because the code that gets eval’d isn’t from general user data submitted via post/get etc, but as spec’d by the site admin only. Of course that code can include ref to $_GET etc if so desired, but the point of the plugin is to give the admin that max unfiltered flexibility, and the code would need to be sanitised if it does depend on client input. 90%+ of the time, code is purely down to the internal state of WP code via conditional tags etc
Hope this helps. Also thanks for the chance to air this – it’s been some time since it was last brought up. Quite happy to discuss if things need to change.
have a look at
Forum: Plugins
In reply to: [Widget Logic] [Plugin: Widget Logic] Paged Post?I googled this http://ifacethoughts.net/2006/05/03/page/
which suggests you could use
global $page; return ($page==1);
or something very like it
Forum: Plugins
In reply to: [Widget Logic] [Plugin: Widget Logic] Conditional date tags?something like
return mktime(0, 0, 0, 7, 1, 2011) < time() && time() < mktime(0, 0, 0, 7, 31, 2011)
should only show in July 2011. mktime params are h/m/s/mon/day/year
Forum: Plugins
In reply to: Widget Logic not working with rokstories plugin, not sure why… theme? me?you can check if it’s the theme, by switching to the WP default.
i’m not sure where to check the code of that theme, or what rokstories plugin is (part of that theme?)