Skip to content
Archive of posts tagged wordpress

Configuring SyntaxHighlighter plugin to StripBrs

I had way too much trouble with the new version of the SyntaxHighlighter Evolved plugin. The default configuration page is missing the option to StripBrs. A quick and dirty solution was to write a plugin to configure the other plugin.

The SyntaxHighlighter configuration is easy. The plugin is running on JavaScript, so all we have to do is to

SyntaxHighlighter.config.stripBrs = true;
SyntaxHighlighter.all();

To get there I wrote a simple plugin that add the new js after WordPress js scripts. Here’s how it’s done:

function add_js_config() {
    wp_register_script( 'syntaxhighlighter_config',
                       plugins_url('syntaxhighlightstripbrs.js',__FILE__),
                       array('jquery','syntaxhighlighter'),
                       '1.0',
                       true);
    wp_enqueue_script('syntaxhighlighter_config');
}
add_action( 'wp_enqueue_scripts', 'add_js_config' );

The plugin can be found from github: https://github.com/Summeli/SyntaxHighlight-StripBrs

Free backups to dropbox from wordpress sites

I have WordPress based sites that I maintain. I haven’t been updating this blog for a while now. Hopefully I’ll get something neat done during this year.

Here’s an easy way to take backups from WordPress blogs a zip archive to the Dropbox.

1. I downloaded the BackUpWordPress plugin to create zip-archives from my blog. It creates a zip file from all the blog database and from all content.

2. I upload the zip file to the Dropbox with WPB2D plugin. I have chosen only the wp-content/backupwordpress-xxx folder, so it will only upload the zip files that I have just created with the BackUpWordPress plugin.

Using the same users in SMF Forum and WordPress

Lately I have developed our climbing club’s website. My goal was to use the same users in Simple Machines Forum (SMF) and WordPress, so no one would have to remember multiple passwords for one site.

For the SMF to WordPress integration I strongly recommend smf2wp plugin https://github.com/jwall149/smf2wp. It creates new WordPress users for every SMF user who goes to the WordPress site while logged into the SMF. Now the WordPress admin can add access rights to the selected users, so they can add and edit content in WordPress site too!

We also had some custom pages for certain SMF user groups which shouldn’t be visible for basic users, so we needed a method to check the SMF groups in the WordPress side. That feature didn’t exist in the smf2wp plugin, so I committed a small update to the smf2wp plugin to get the SMF user group check working on the WordPress side.

Here’s an example how to do the access rights check (currently works only with the latest git-version)

global $smf_user_info;
/*The SMF groups that can access the content*/
$accessRights = array(1,2,3);
foreach ($smf_user_info['smf_groups'] as $i =----> $v) {
	$user_groups[$i] = (int) $v;
}
if(array_intersect($user_groups,$accessRights)) {
	echo "Secret pages for groups 1,2 and 3";
}

Download-Feed: my first WordPress plugin

Download-Feed is a plugin for creating a XML feed from downloads created with Download-Monitor WordPress plugin.

The XML feed could be used for integrating a mobile client into the download-interface, so any WordPress powered blog could be turn into “appstore” type of application delivery system, without payments.

Here’s an example of a donwload entry from the XML-feed.


    AntSnes_v071.sis
    0.71
    
    
      AntSnes
      1
    
    6784
    http://www.summeli.com/wp-content/plugins/download-monitor/img/download.gif
    http://www.summeli.com/wp-content/plugins/download-monitor/download.php?id=5"/>
  

The Downloads can be queried by category, and there’s an option to limit how many items should be requested, and what’s the offset. So it could be used even with very big list of entries (like appstore :))

Continue reading ‘Download-Feed: my first WordPress plugin’ »