• Resolved seeker2734

    (@seeker2734)


    I’m using the TablePress plugin with some good results (though CSS styling is still quite a challenge) except for one issue that seems to have been seen before. I also use the Subscribe2 plugin to send e-mail notifications to the site users for new posts. I’m experiencing similar results as was described in this post where the shortcode works and shows a table properly in posts and pages in a browser but, in an e-mail notification, shows instead as a plain text shortcode rather than as a table.

    I know that previous thread re: JetPack was closed, but I also found this post in the support for the Subscribe2 plugin that may help with resolving this issue with TablePress. It seems that the problem is in how the shortcodes are registered, i.e. registered only with the front end of the site versus the admin screens. Frankly, I’m not 100% sure what that means, but it seems that if the shortcodes for TablePress could be registered in the admin screens versus the front end then the tables could appear in the notification emails, solving this problem for at least the two plugins referenced here (Subscribe2 and JetPack).

    I believe this registration of the shortcodes should be possible since, for example, I also use the Ultimate TinyMCE Pro plugin, and the shortcodes for that plugin, such as [signoff], appear correctly in any notification emails.

    Any insight? Thanks for your help!

    WP v3.8.1
    TablePress v1.3

    https://wordpress.org/plugins/tablepress/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    The reason for this is indeed that TablePress does not register its Shortcodes in the admin area (because it never needs them there), to save to memory and processing time.

    As you apparently might need the Shortcodes in the admin area for those other plugins, I suggest that you try to initialize the manually, by adding this to the “functions.php” file in your theme:

    function run_tablepress_shortcodes_in_admin() {
    	if ( is_admin() ) {
    		$GLOBALS['tablepress_frontend_controller'] = self::load_controller( 'frontend' );
    	}
    }
    add_action( 'tablepress_run', 'run_tablepress_shortcodes_in_admin' );

    Regards,
    Tobias

    Thread Starter seeker2734

    (@seeker2734)

    Tobias,

    Thanks for the code. I added it to the functions.php for my current theme and received the following error when accessing the site:

    Fatal error: Cannot access self:: when no class scope is active in /home/content/64/5303764/html/member/wp-content/themes/graphene/functions.php on line 48

    Line 48 is the following code:

    $GLOBALS['tablepress_frontend_controller'] = self::load_controller( 'frontend' );

    Any insight? Thanks again for your help!

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    ah, my bad, there’s a small mistake in the code.
    self has to be replaced with TablePress:

    function run_tablepress_shortcodes_in_admin() {
    	if ( is_admin() ) {
    		$GLOBALS['tablepress_frontend_controller'] = TablePress::load_controller( 'frontend' );
    	}
    }
    add_action( 'tablepress_run', 'run_tablepress_shortcodes_in_admin' );

    Regards,
    Tobias

    Thread Starter seeker2734

    (@seeker2734)

    Thanks for the quick reply.

    I’ve tried the new code and now receive the following error:

    Fatal error: Call to a member function get() on a non-object in /home/content/64/5303764/html/member/wp-content/plugins/tablepress/classes/class-controller.php on line 85

    Is there another change I would need to make?

    Thanks again!

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    okay, another try:

    function run_tablepress_shortcodes_in_admin() {
    	if ( is_admin() ) {
    		TablePress::$model_options = TablePress::load_model( 'options' );
    		TablePress::$model_table = TablePress::load_model( 'table' );
    		$GLOBALS['tablepress_frontend_controller'] = TablePress::load_controller( 'frontend' );
    	}
    }
    add_action( 'tablepress_run', 'run_tablepress_shortcodes_in_admin' );

    Regards,
    Tobias

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

The topic ‘TablePress and Email Notification Plugins’ is closed to new replies.