Forum Replies Created

Viewing 15 replies - 16 through 30 (of 46 total)
  • Thread Starter DrHariri

    (@ala7lam)

    Hi Yannick,

    Could you help me understand how I would get a certain value like link_name? I am mostly used to using get_post_meta and I am guessing in this case I have to somehow do something like:

    $link_title = $linkdata->link_name;

    Or is this completely wrong? I thought I’d test a few ideas before paying someone to do it lol.

    Thanks!

    Thread Starter DrHariri

    (@ala7lam)

    Good work Yannick! Will test it and let you know!
    I’ve donated in the past and certainly will do so again :).

    Thanks!

    Thread Starter DrHariri

    (@ala7lam)

    Excellent! =)

    Thread Starter DrHariri

    (@ala7lam)

    That would be nice ?? I can think of many uses for that:
    1) Post to Buffer
    2) Add points to the user for contributing, etc..

    Is it possible to access these variables with the action hook:
    – URL
    – Title
    – Description
    – User_ID or User meta
    I am new to hooks but I guess if we could fetch the user variable or user meta that would be great, but hopefully this is do-able and not too much to ask :).

    Many thanks for your very quick response!

    I am also getting this error when contributors are trying to write.

    Thread Starter DrHariri

    (@ala7lam)

    Update: The code in #2 isn’t working as intended. I have posted a request for help on StackExchange. Hopefully someone will help me spot the issue and I would update it here.

    Thread Starter DrHariri

    (@ala7lam)

    You are welcome! Thanks for this great plugin :).

    Thread Starter DrHariri

    (@ala7lam)

    Again, no developer/coder here but I tested these and they work for me. If anyone have any suggestions or edits, please comment.

    I hope some of you find it of use!

    Thread Starter DrHariri

    (@ala7lam)

    2) If you want the status to change as soon as the author loads the page editing page, which can be useful to track who started an initiate an e-mail or something, you can use something like this:
    ————

    //------------ Start Swtich from Assigned to In Progress on post edit page load ------//
    function educadme_assigned_to_inprogress( $post_id ) {
    	if ( current_user_can('edit_post', $post_id) && !current_user_can( 'manage_options' ) ) {
    
    				$post = get_post($post_id);
    			    if (get_post_type()=='post' && $post->post_status =='assigned' && strstr($_SERVER['REQUEST_URI'], 'wp-admin/post-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/post.php')) {
    			    		$post->post_status = 'in-progress'; // use any post status
    						wp_update_post($post);
    					}
    		}
    }
    add_action('add_meta_boxes', 'educadme_assigned_to_inprogress');

    Thread Starter DrHariri

    (@ala7lam)

    I figured this out. I am not a coder but this does the job for me.

    1) Limit available statuses based on current post status. This is a modified version available on the “extend” page of the plugin.

    Basically, $permitted_statuses lists all possible statuses which you want to allow users to choose from at any given stage.

    Then, I used $permitted_on_initial, $permitted_on_assigned, and $permitted_on_inprogress to limit available statuses based on these stages.

    For instance, I am allowing draft to only show when the status is in progress.

    —————–

    function efx_limit_custom_statuses_by_role( $custom_statuses ) {
        $current_user = wp_get_current_user();
        // $post = get_post();
    
        switch( $current_user->roles[0] ) {
            // Only allow a contributor to access specific statuses from the dropdown
            case 'contributor':
                $permitted_statuses = array(
                        'initial-idea',
                        'assigned',
                        'in-progress',
                        'draft',
                    );
    
                $permitted_on_initial = 'initial-idea';
                $permitted_on_assigned = 'assigned';
                $permitted_on_inprogress = array(
                        'in-progress',
                        'draft',
                    );
    
                // Remove the custom status if it's not whitelisted
                foreach( $custom_statuses as $key => $custom_status ) {
    
                    if (!in_array( $custom_status->slug, $permitted_statuses ) || $custom_status->slug =='initial-idea' && !in_array( $custom_status->slug, $permitted_on_initial ) || $custom_status->slug =='assigned' && !in_array( $custom_status->slug, $permitted_on_assigned ) || $custom_status->slug =='in-progress' && !in_array( $custom_status->slug, $permitted_on_inprogress ) )
                        unset( $custom_statuses[$key] );                               
    
                }
                break;
        }
        return $custom_statuses;
    }
    add_filter( 'ef_custom_status_list', 'efx_limit_custom_statuses_by_role' );

    Thread Starter DrHariri

    (@ala7lam)

    Forgot to mention that allowing the user to define the slug only on creation and locking it after that is another approach :).

    Thanks!

    Thread Starter DrHariri

    (@ala7lam)

    I can see where you are coming from for sure. I will give the DB change a go.

    Is there a way to make these statuses translate-able? Therefore, having the slug as it is but being able to change the actual name that appears on the drop-down menu for example?

    This might be another way of achieving it without causing the issues you referred to.

    Many thanks!

    Thread Starter DrHariri

    (@ala7lam)

    It’s seems to be working fine now. Please delete the post is possible!

    Forum: Plugins
    In reply to: [BadgeOS] Custom Fields?

    Was looking to do the same thing and hopefully be able to map a custom field to Credly instead of the default ones.

    Thanks all!

    Thread Starter DrHariri

    (@ala7lam)

    I have the core and:
    BadgeOS Sensei Add-On
    Leaderboards
    Messages

    However, the last 2 are not yet activated.

    There seems to be something off but I can’t tell from what. I am passing user meta fields to an external service normally but can’t seem to pass a value for the points anymore. for all of the other meta fields, I am passing them with profile update. Could this be related to how the points might be calculated for the admin?

    Thanks!

Viewing 15 replies - 16 through 30 (of 46 total)