Skip to:
Content
Pages
Categories
Search
Top
Bottom

sitewide notice


  • sugar7
    Participant

    @sugar7

    Hi there

    past webmaster(s) added a notice that appears the first time users log-in – a div id=”sidewide-notice” leads me to find; class-bp-messages-sitewide-notices-widget.php This hasn’t helped me to figure how to stop the message from popping up. What can I do/try?

    Any help appreciated, thanks, Dylan

Viewing 13 replies - 1 through 13 (of 13 total)

  • Venutius
    Moderator

    @venutius

    Is it in your functions.php or wp-custom.php?


    sugar7
    Participant

    @sugar7

    this is the full path; /public_html/wp-content/plugins/buddypress/bp-messages/classes/class-bp-messages-sitewide-notices-widget.php


    Venutius
    Moderator

    @venutius

    functions.php or bp-custom.php is possibly where an additional function has been setup to create the notice:

    wp-content/themes/your child theme/functions.php

    or

    wp-content/plugins/bp-custom.php


    sugar7
    Participant

    @sugar7

    The first file;
    <?php
    /**
    * @package Boss Child Theme
    * The parent theme functions are located at /boss/buddyboss-inc/theme-functions.php
    * Add your own functions in this file.
    */

    /**
    * Sets up theme defaults
    *
    * @since Boss Child Theme 1.0.0
    */
    function boss_child_theme_setup()
    {
    /**
    * Makes child theme available for translation.
    * Translations can be added into the /languages/ directory.
    * Read more at: http://www.buddyboss.com/tutorials/language-translations/
    */

    // Translate text from the PARENT theme.
    load_theme_textdomain( ‘boss’, get_stylesheet_directory() . ‘/languages’ );

    // Translate text from the CHILD theme only.
    // Change ‘boss’ instances in all child theme files to ‘boss_child_theme’.
    // load_theme_textdomain( ‘boss_child_theme’, get_stylesheet_directory() . ‘/languages’ );

    }
    add_action( ‘after_setup_theme’, ‘boss_child_theme_setup’ );

    /**
    * Enqueues scripts and styles for child theme front-end.
    *
    * @since Boss Child Theme 1.0.0
    */
    function boss_child_theme_scripts_styles()
    {
    /**
    * Scripts and Styles loaded by the parent theme can be unloaded if needed
    * using wp_deregister_script or wp_deregister_style.
    *
    * See the WordPress Codex for more information about those functions:
    * https://codex.wordpress.org/Function_Reference/wp_deregister_script
    * https://codex.wordpress.org/Function_Reference/wp_deregister_style
    **/

    /*
    * Styles
    */
    wp_enqueue_style( ‘boss-child-custom’, get_stylesheet_directory_uri().’/css/custom.css’ );
    }
    add_action( ‘wp_enqueue_scripts’, ‘boss_child_theme_scripts_styles’, 9999 );

    /****************************** CUSTOM FUNCTIONS ******************************/

    // Add your own custom functions here

    ?>

    The second contains:

    <?php

    if ( !defined( ‘BP_AVATAR_THUMB_WIDTH’ ) )
    define( ‘BP_AVATAR_THUMB_WIDTH’, 35 ); //change this with your desired thumb width

    if ( !defined( ‘BP_AVATAR_THUMB_HEIGHT’ ) )
    define( ‘BP_AVATAR_THUMB_HEIGHT’, 35 ); //change this with your desired thumb height

    ?>


    sugar7
    Participant

    @sugar7

    The first file (class-bp-messages-sitewide-notices-widget.php) may be more useful?

    <?php
    /**
    * BuddyPress Messages Sitewide Notices Widget.
    *
    * @package BuddyPress
    * @subpackage Messages
    * @since 1.9.0
    */

    // Exit if accessed directly.
    defined( ‘ABSPATH’ ) || exit;

    /**
    * A widget that displays sitewide notices.
    *
    * @since 1.9.0
    */
    class BP_Messages_Sitewide_Notices_Widget extends WP_Widget {

    /**
    * Constructor method.
    */
    function __construct() {
    parent::__construct(
    ‘bp_messages_sitewide_notices_widget’,
    __( ‘(BuddyPress) Sitewide Notices’, ‘buddypress’ ),
    array(
    ‘classname’ => ‘widget_bp_core_sitewide_messages buddypress widget’,
    ‘description’ => __( ‘Display Sitewide Notices posted by the site administrator’, ‘buddypress’ ),
    ‘customize_selective_refresh’ => true,
    )
    );
    }

    /**
    * Render the widget.
    *
    * @see WP_Widget::widget() for a description of parameters.
    *
    * @param array $args See {@WP_Widget::widget()}.
    * @param array $instance See {@WP_Widget::widget()}.
    */
    public function widget( $args, $instance ) {

    if ( ! is_user_logged_in() ) {
    return;
    }

    // Don’t display the widget if there are no Notices to show.
    $notices = BP_Messages_Notice::get_active();
    if ( empty( $notices ) ) {
    return;
    }

    extract( $args );

    $title = ! empty( $instance[‘title’] ) ? $instance[‘title’] : ”;

    /**
    * Filters the title of the Messages widget.
    *
    * @since 1.9.0
    * @since 2.3.0 Added ‘instance’ and ‘id_base’ to arguments passed to filter.
    *
    * @param string $title The widget title.
    * @param array $instance The settings for the particular instance of the widget.
    * @param string $id_base Root ID for all widgets of this type.
    */
    $title = apply_filters( ‘widget_title’, $title, $instance, $this->id_base );

    echo $before_widget;
    echo $before_title . $title . $after_title; ?>

    <div class=”bp-site-wide-message”>
    <?php bp_message_get_notices(); ?>
    </div>

    <?php

    echo $after_widget;
    }

    /**
    * Process the saved settings for the widget.
    *
    * @see WP_Widget::update() for a description of parameters and
    * return values.
    *
    * @param array $new_instance See {@WP_Widget::update()}.
    * @param array $old_instance See {@WP_Widget::update()}.
    * @return array $instance See {@WP_Widget::update()}.
    */
    public function update( $new_instance, $old_instance ) {
    $instance = $old_instance;
    $instance[‘title’] = strip_tags( $new_instance[‘title’] );
    return $instance;
    }

    /**
    * Render the settings form for Appearance > Widgets.
    *
    * @see WP_Widget::form() for a description of parameters.
    *
    * @param array $instance See {@WP_Widget::form()}.
    *
    * @return string|null Widget form output.
    */
    public function form( $instance ) {
    $instance = wp_parse_args( (array) $instance, array(
    ‘title’ => ”,
    ) );

    $title = strip_tags( $instance[‘title’] ); ?>

    <p>
    <label for=”<?php echo $this->get_field_id( ‘title’ ); ?>”><?php _e( ‘Title:’, ‘buddypress’ ); ?></label>
    <input class=”widefat” id=”<?php echo $this->get_field_id( ‘title’ ); ?>” name=”<?php echo $this->get_field_name( ‘title’ ); ?>” type=”text” value=”<?php echo esc_attr( $title ); ?>” />
    </p>

    <?php
    }
    }


    Venutius
    Moderator

    @venutius

    It sounds like you need to hire someone with knowledge to look at your site and remove that function. It could have been added in a number of ways. Could even be done via a plugin.


    sugar7
    Participant

    @sugar7

    We’re a volunteer run company, so it’s up to me to figure it out along with help from forums like this.. (and generosity of people like yourself). I was hoping someone with php coding knowledge would be able to at least explain where to look – eg where would the notice text be stored? ie. in what type of file? The search function in cPanel doesn’t seem to search inside of files – is this possible somehow?


    Venutius
    Moderator

    @venutius

    Well the function that is probably being used is messages_send_notice, but that’s not guaranteed, you’d need to search for that in your plugins and theme directories files, that’s where the function you are looking for are likely to reside.


    wbcomdesigns
    Participant

    @wbcomdesigns

    @sugar7 you need to delete or deactivate any site-wide notice after login as the site.
    It will remove default notices for new users as well.


    sugar7
    Participant

    @sugar7

    @venutius thanks; I did another search but nothing similar to that in either of those 2 places…


    @wbcomdesigns
    Do you mean log in as Admin to the site? The notice doesn’t appear for log in – it probably did once, but when it is closed it does not appear again… only for new users who log in..

    Here is the screenshot when I inspect the page the notice appears on – I thought this would show where the message is coming from…. Why so difficult??!

    inspect of notice


    Venutius
    Moderator

    @venutius

    What Varun means is he thinks this is an old notice that’s not been removed, so login as admin and make sure you delete any sitewide notices that are still set up. Go to Profile>>Messages>>All Member Notices, you should be able to delete any there.


    sugar7
    Participant

    @sugar7

    Brilliant @wbcomdesigns !! I went to Profile>>Messages>>All Member Notices and it was there – Deactivated it… simple… as I thought it must of been…

    THANK YOU GUYS!!!


    Varun Dubey
    Participant

    @vapvarun

    Great, Glad we can help 🙂

Viewing 13 replies - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.
Skip to toolbar