PluginProbe ʕ •ᴥ•ʔ
Simple Author Box / 2.4
Simple Author Box v2.4
2.61 trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.9 2.0 2.0.1 2.0.2 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.3.11 2.3.12 2.3.15 2.3.16 2.3.2 2.3.20 2.3.21 2.3.22 2.4 2.41 2.42 2.45 2.46 2.47 2.48 2.49 2.50 2.51 2.52 2.54 2.55 2.56 2.57 2.59 2.60
simple-author-box / inc / functions.php
simple-author-box / inc Last commit date
elementor 5 years ago class-simple-author-box-admin-page.php 5 years ago class-simple-author-box-block.php 5 years ago class-simple-author-box-helper.php 5 years ago class-simple-author-box-previewer.php 5 years ago class-simple-author-box-social.php 6 years ago class-simple-author-box-user-profile.php 5 years ago class-simple-author-box-widget.php 5 years ago class-simple-author-box.php 5 years ago functions.php 5 years ago
functions.php
94 lines
1 <?php
2
3 // If this file is called directly, busted!
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7
8 /*----------------------------------------------------------------------------------------------------------
9 Adding the author box to the end of your single post
10 -----------------------------------------------------------------------------------------------------------*/
11 if ( ! function_exists( 'wpsabox_author_box' ) ) {
12
13
14 function wpsabox_author_box( $saboxmeta = null, $user_id = null) {
15
16 $show = ( is_single() || is_author() || is_archive() );
17
18 /**
19 * Hook: sabox_check_if_show.
20 *
21 * @hooked Simple_Author_Box::check_if_show_archive - 10
22 */
23
24 $show = apply_filters( 'sabox_check_if_show', $show );
25
26 if ( $show ) {
27
28 global $post;
29
30 $template = Simple_Author_Box_Helper::get_template();
31
32 ob_start();
33 $sabox_options = Simple_Author_Box_Helper::get_option( 'saboxplugin_options' );
34 $sabox_author_id = $user_id ? $user_id : $post->post_author;
35 $show_post_author_box = apply_filters( 'sabox_check_if_show_post_author_box', true, $sabox_options );
36
37 do_action( 'sabox_before_author_box', $sabox_options );
38
39 if ( $show_post_author_box ) {
40 include( $template );
41 }
42
43 do_action( 'sabox_after_author_box', $sabox_options );
44
45 $sabox = ob_get_clean();
46 $return = $saboxmeta . $sabox;
47
48 // Filter returning HTML of the Author Box
49 $saboxmeta = apply_filters( 'sabox_return_html', $return, $sabox, $saboxmeta );
50
51 }
52
53 return $saboxmeta;
54 }
55 }
56
57 //return notice if user hasn't filled Biographical Info
58 function sab_user_description_notice() {
59 $user_id = get_current_user_id();
60 $user = get_userdata( $user_id );
61 $user_descrition = $user->description;
62 $user_roles = $user->roles;
63 if ( ! $user_descrition && in_array( 'author', $user_roles ) ) {
64
65 ?>
66 <div class="notice notice-info is-dismissible">
67 <p><?php _e( 'Please complete Biographical Info', 'simple-author-box' ); ?></p>
68 </div>
69 <?php
70 }
71 }
72
73 add_action( 'admin_notices', 'sab_user_description_notice' );
74
75
76 //return notice if user hasn't filled any social profiles
77 function sab_user_social_notice() {
78 $user_id = get_current_user_id();
79 $user_social = get_user_meta( $user_id, 'sabox_social_links' );
80 $user = get_userdata( $user_id );
81 $user_roles = $user->roles;
82
83 if ( ! $user_social && in_array( 'author', $user_roles ) ) {
84
85 ?>
86 <div class="notice notice-info is-dismissible">
87 <p><?php _e( 'Please enter a social profile', 'simple-author-box' ); ?></p>
88 </div>
89 <?php
90 }
91 }
92
93 add_action( 'admin_notices', 'sab_user_social_notice' );
94