Forum Replies Created
-
AuthorPosts
-
Anh Tran
KeymasterI'm afraid not. The "Attactment Details" popup is created and triggered by JavaScript, while most of our work is PHP.
Anh Tran
KeymasterThis is the list of supported conditions for Include Exclude extension. But if you use it for user profile (with User Meta extension), then you can use only "user_role" and "user_id".
If you want to show/hide fields for a certain ID/groups, you should use the Conditional Logic extension.
See this for the difference between Include/Exclude and Conditional Logic.
Regarding the 2nd question about MB Admin Columns: currently it works only for posts, pages and custom post types.
February 10, 2017 at 10:37 AM in reply to: Page/Post Attributes List is flat and need to indent deferent levels #5035Anh Tran
KeymasterHi Tami, can you please post a screenshot for the Page/Post Attributes? I can't find it in the MB Builder extension.
Anh Tran
KeymasterYou can define the order of your meta boxes only. Doing that by organizing the PHP code.
It's impossible to change the order of other sections in the user profile page, because they's hardcoded by WordPress or other plugins.
Anh Tran
KeymasterUsing
current_user_canonly checks for the role of the current user, not the role of the being edited user. The MB Include Exclude extension can handle that.To make a field required, you can simply add
'required' => true. Docs here and here.Anh Tran
KeymasterIf you want the callback print the content, you can try output buffering, like this:
function hello() { ob_start(); echo 'Your content'; return ob_get_clean(); }This makes the logic of the plugin consistent ('std' vs 'callback').
Anh Tran
KeymasterJust go to your "My Account" page (click on your avatar) and download the "MB Include Exclude" extension.
Also, read this guide to know about automatic update.
Anh Tran
KeymasterHi, I've just updated the Include Exclude extension to support "user_role" and "user_id" rules. Please try this.
Anh Tran
KeymasterHi Dave,
I've just updated the Include Exclude extension. It works with the MB User Meta extension now.
Anh Tran
KeymasterHi, I will work on the Include Exclude extension for that. Currently, it has "user_role" rule (include/exclude meta boxes for a certain user role), but hasn't worked with MB User Meta yet.
Anh Tran
KeymasterThat works but it affects your performance as the action "check-update" runs on every request to your website. This triggers the query to the database. Running only on your settings page reduces the load. But that also means the value is updated only when users visit the settings page, so it's kind of manual reset.
Anh Tran
KeymasterAh, I got it. I will check that ๐
Thanks for your suggestion!
Anh Tran
KeymasterHere it is:
function hello() { return '<b style="color:red;">Hello</b>'; }Anh Tran
KeymasterHi,
How do you get the
$post_idand how do you use the code above inside your code to register meta boxes?Anh Tran
KeymasterI got it. In this case, the problem is handling the "saved meta value". I'd suggest using WP cron to perform a regular check on the meta value (posts). When a condition occurs (date is passed), then update the meta value.
This is the pseudo code:
register_activation_hook(__FILE__, 'prefix_activation'); function prefix_activation() { if (! wp_next_scheduled ( 'prefix_daily_check' )) { wp_schedule_event(time(), 'hourly', 'prefix_daily_check'); } } add_action('prefix_daily_check', 'prefix_update_posts_daily'); function prefix_update_posts_daily() { $now = time(); $option = get_option( 'featured_position_1' ); foreach ( $option as $key => $value ) { if ( $time > strtotime( $value['featured_item_1_schedule_start'] ) ) { unset( $option[$key] ); } } update_option( 'featured_position_1', $option ); } -
AuthorPosts