Plugin to manage user permissions that saves settings to file instead of database [closed]

I want to manage user roles and permissions/capabilities through a plugin. Most plugins save their settings to the database. Since we’re running multiple environments with seperate databases, saving to the database is inconvenient. After every deploy we’d have to update the settings on the other environment.

What I’m looking for is a plugin which persists its settings to a file, much like ACF does with the acf-json folder. This way I don’t have to remember to update the settings after every deploy. Is there any plugin which does this?

I’m aware there are plugins with manual backup/restore functionality. While this does alleviate the problem, it’s not the solution I’m looking for

Mailpoet WordPress Plugin

We updated the Mailpoet plugin from Version 3.60.11 to Version 3.61.11 recently and our site crashed with a fatal error:

Fatal error: Uncaught TypeError: Argument 2 passed to MailPoet\WP\Functions::addFilter() must be callable, array given, called in /home/customer/ourdomain/public_html/wp-content/plugins/mailpoet/lib/Config/Initializer.php on line 182 and defined in /home/customer/www/ourdomain/public_html/wp-content/plugins/mailpoet/lib/WP/Functions.php:79 Stack trace: #0 /home/customer/www/ourdomain/public_html/wp-content/plugins/mailpoet/lib/Config/Initializer.php(182): MailPoet\WP\Functions->addFilter(‘wpmu_drop_table…’, Array) #1 /home/customer/www/ourdomain/public_html/wp-content/plugins/mailpoet/mailpoet_initializer.php(81): MailPoet\Config\Initializer->init() #2 /home/customer/www/ourdomain/public_html/wp-content/plugins/mailpoet/mailpoet.php(114): require_once(‘/home/customer/…’) #3 /home/customer/www/ourdomain/public_html/wp-settings.php(391): include_once(‘/home/customer/…’) #4 /home/customer/www/ourdomain/public_html/wp-config.php(91): requir in /home/customer/www/ourdomain/public_html/wp-content/plugins/mailpoet/lib/WP/Functions.php on line 79

We have reported the issue in the plugin’s forum on WordPress too but still haven’t received a fix. Here’s the link to the post:

https://wordpress.org/support/topic/fatal-error-while-updating-mailpoet/#post-14466785

For reference, we are using WordPress version 5.7.2 and PHP version 7.3.2

Can anybody help with the above error?

Thanks in advance

How to run a bash script from a plugin?

I am lookin for some guidance. I have a host command that has to be runned between two functions in a plug-in I am working on.

Long story short,

I have built a class which holds two methods, namely: pdf_handler() and pdf_signer() – Now I realize the names suck.

Within pdf_handler I am filling some form fields in a pdf – all good. In the pdf_signer I need to apply a png image with the user’s signature to that pdf file – can be done.

The problem comes in the flow: After I fill the form and I save it under a new file I have to import the document again for signing it. On import, the document looses all the form fields including the data within. The solution to this is to ‘flatten’ the form to the pdf, which can be done with pdftk, which is a server/host program.

Short story even shorter,

$  this->pdf_handler(); pdftk file.pdf output file_flat.pdf flatten; <---- Unexpected something PHP left the room. $  this->pdf_signer(); 

My question is; How can I execute a bash/cmd script from php, within a wordpress plugin’s class? (I don’t really care about Windows)

Calling a plugin function in a template [closed]

I’m using the WP-property plugin with the import addon. It imports properties from a local MLS. In the property edit screen, it displays the last import time and date in the meta box. I need to display this on the font end. (The plugin docs don’t provide a way to do this).

I found the function that displays this time and date (it is edited to suit my needs for a font-end display). The class name is class_wpp_property_import

      static public function wpp_publish_box_options( $  id ) {     global $  post, $  wp_properties;      if( !$  wpp_import_schedule_id = get_post_meta( $  post->ID, 'wpp_import_schedule_id', true ) ) {       return;     }      //** Get time stamp from new format ( Version 2.6.0+ ) */     $  import_time = get_post_meta( $  post->ID, 'wpp_import_time', true );      //** Get time stamp from old meta_key ( pre-version 2.6.0 ) if new meta_key does not exist */     if( empty( $  import_time ) ) {       $  import_time = get_post_meta( $  post->ID, 'wpp_xml_import', true );     }      if( !empty( $  import_time ) ) {       $  import_time = date_i18n( __( 'M j, Y @ G:i', ud_get_wpp_importer()->domain ), strtotime( $  import_time ) );       ?>        <div class="misc-pub-section xml_import_time misc-pub-section-last">         <span class="wpp_i_time_stamp"><?php printf( __( 'Imported on: <b>%1$  s</b>', ud_get_wpp_importer()->domain ), $  import_time, $  import_url, $  import_name ); ?>           <b></b></span>       </div>     <?php     }    } 

But when I add this (as a shortcode) I get a critical error. I’m using another plugin to create the shortcode easily.

I’ve also tried just using the HTML within the divs (also via shortcode) hoping that the function is firing anyhow, but no go. I’m wondering if it only fires on the backend.

Any help on this? I’ve been at it for a while and I think my brain is fried.

I tried calling the class, still get a critical error:

    class class_wpp_property_import {   static public function wpp_publish_box_options( $  id ) {     global $  post, $  wp_properties;      if( !$  wpp_import_schedule_id = get_post_meta( $  post->ID, 'wpp_import_schedule_id', true ) ) {       return;     }      //** Get time stamp from new format ( Version 2.6.0+ ) */     $  import_time = get_post_meta( $  post->ID, 'wpp_import_time', true );      //** Get time stamp from old meta_key ( pre-version 2.6.0 ) if new meta_key does not exist */     if( empty( $  import_time ) ) {       $  import_time = get_post_meta( $  post->ID, 'wpp_xml_import', true );     }      if( !empty( $  import_time ) ) {       $  import_time = date_i18n( __( 'M j, Y @ G:i', ud_get_wpp_importer()->domain ), strtotime( $  import_time ) );       ?>        <div class="misc-pub-section xml_import_time misc-pub-section-last">         <span class="wpp_i_time_stamp"><?php printf( __( 'Imported on: <b>%1$  s</b>', ud_get_wpp_importer()->domain ), $  import_time, $  import_url, $  import_name ); ?>           <b></b></span>       </div>     <?php     }    }}  

Plugin for streamlining image post creation?

I have a photo gallery website, with one post for each image. Currently, the process for creating these posts is cumbersome: I click "add new post," add the title and description, then click "set featured image," find the photo, and add the same title and description (with different formatting). Is there a wordpress plugin that would streamline this process? That is, something like the flickr uploadr or a plugin that would allow me to iterate through the images in the media library and create a post for each?

Display related posts without a plugin

I’m trying to display the related posts using functions.php:

function posts_related($  related){ if (is_single()) { global $  post; // Build basic custom query arguments $  custom_query = new WP_Query( array(         'posts_per_page' => 8, // Number of related posts to display        'post__not_in' => array($  post->ID), // Ensure that the current post is not displayed        'orderby' => 'rand', // Randomize the results ));  // Run the loop and output data for the results if ( $  custom_query->have_posts() ) : while ( $  custom_query->have_posts() ) : $  custom_query->the_post();   if ( has_post_thumbnail()   ) {                   $  permalink = the_permalink();                  $  post_thumbnail = the_post_thumbnail('medium');                  $  title = the_title();                                         $  related .= '<a href="' . $  permalink .  '"><img src="' . $  post_thumbnail . '/></a>';                               }            $  related .=  '<a href="' .  $  permalink . '"><b>' . $  title . '</b></a>';      endwhile;   else :      $  related .= '<p>Nothing to show.</p>'; endif; // Reset postdata }          echo '<pre>'; var_dump( has_post_thumbnail() ); echo '</pre>';       return $  related;  }    //wp_reset_postdata();  add_filter( "the_content", "posts_related", 99 ); add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 100, 50, true ); 

But I’m not being able to handle the output properly. I need it to display below the post (single post).

TranslatePress plugin delayed translated language loading?

I installed the TranslatePress plugin on a website to translate the site into one language using manual translation only. This setup was tested on a dev site and all seemed to work well. However, on the live site there is a delay of around 2-3 seconds where the translated pages initially display the default language before then displaying the translated text. This looks terrible and I need to find a fix.

I have cleared all website caches, browser cache, saved permalinks, set file permissions & ownership, and tried different server settings without success.

Debugging the issue, it seems to relate to the TranslatePress ajax call (trp-ajax) returning no data, which in turn appears to be the result of a database call being blocked at line 26 of the trp-ajax.php file, causing the error output to display from line 38, which I verified via logging.

I copied the website in full onto a very similar server, which doesn’t display the problem, which is therefore pointing me towards an issue with the server environment. However, nothing seems amiss.

Run command “composer install” when activating wordpress plugin

I want to run the command : "composer install –prefer-dist" in a wordpress plugin in the hook register_activation_hook to install the require vendors. But when I trying to activating the plugin the error below is generate. Do you have a way to install the required composers when activate the plugin?

Fatal error: Uncaught Error: Class ‘App\XXXXX’ not found in /../wordpress/wp-content/plugins/my-plugin/my-plugin.php:54 Stack trace: #0 /../wordpress/wp-admin/includes/plugin.php(2300): include() #1 /../wordpress/wp-admin/plugins.php(191): plugin_sandbox_scrape(‘my-plugin/my-…’) #2 {main} thrown in /../wordpress/wp-content/plugins/my-plugin/my-plugin.php on line 54