• Resolved melchi2

    (@melchi2)


    Hello,

    I used the application, I encountered an inconvenience, when we write a publication it does not appear on the social wall in ultimate memeber If I write the article in the back office, the article appears on the social wall.
    How can I resolve the incident?
    I would like to know if there is a solution so that the article created can appear on the social wall of all members?

    • This topic was modified 2 years ago by melchi2.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter melchi2

    (@melchi2)

    Hello,
    Do you have a solution, thank you very much

    Thread Starter melchi2

    (@melchi2)

    I found a better solution a notification when a new article is created and visible to all
    
    add_filter( 'um_notifications_core_log_types', 'add_new_article_notification_type', 200 );
    function add_new_article_notification_type( $array ) {
        $array['new_article'] = array(
            'title' => 'Nouvel article publié',
            'template' => 'Un nouvel article intitulé "{article_title}" a été publié par {member}.',
            'account_desc' => 'Quand un nouvel article est publié sur le site',
        );
    
        return $array;
    }
    
    add_filter( 'um_notifications_get_icon', 'add_new_article_notification_icon', 10, 2 );
    function add_new_article_notification_icon( $output, $type ) {
        if ( $type == 'new_article' ) {
            $output = '<i class="um-icon-article" style="color: #336699"></i>';
        }
    
        return $output;
    }
    
    add_action( 'publish_post', 'send_new_article_notification', 10, 2 );
    function send_new_article_notification( $ID, $post ) {
        $author_id = $post->post_author;
        $title = $post->post_title;
        $permalink = get_permalink( $ID );
    
        um_fetch_user( $author_id );
        $author_name = um_user( 'display_name' );
    
        $vars = array(
            'article_title' => $title,
            'member' => $author_name,
            'notification_uri' => $permalink,
        );
    
        // Envoyer une notification à tous les utilisateurs du site
        $users = get_users();
        foreach ( $users as $user ) {
            UM()->Notifications_API()->api()->store_notification( $user->ID, 'new_article', $vars );
        }
    }
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Ultimate member’ is closed to new replies.