Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
plugins-topic
5.0 Alpha Plugins
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jun 20, 2011 - 9:22 pm

Please report any issues with plugins or API in this forum.

In the svn topic, you will see the repo for the current sp plugins.  We highly suggest you check out that svn repo and take a look at those plugins for ideas and general flow.  We have not generated any documentation for the plugin api yet, so examples and questions posted here will be best bet.

You can look at the plugins api code in simple-press/sp-api/sp-api-plugins.php to get a basic understanding. but, frankly, not much in there you will actually need to use except for admin panel creation.  Your plugin's basic interaction with SP will be through hooks - actions and filters - much like plugins do with WP.  A good primer:

http://codex.wordpress.org/Plugin_API

Unfortunately, we havent yet created a list of actions and filters available in 5.0 largely because they are still work in progress.  So if you cant find one you are looking for, ask.

Plugins for SP only have a couple of hard requirements.  They all must be located within one parent folder.  You can define the location of this directory on forum - wp integration - storage locations.  Each plugin within this folder, must be located within its own directory.  You can create as many subdirectories within this specific plugin folder as you like to organized your plugin.  You will see we have centered up on a structure for our plugins, but that is not required.

Additionally, you must put the following header information at the top of your main plugin file:

/*
Simple:Press Plugin Title: Who's Online
Version: 1.0
Plugin URI: https://simple-press.com
Description: A Simple:Press plugin for showing who is online around your forum
Author: Andy Staines & Steve Klasen
Author URI: https://simple-press.com
Simple:Press Versions: 5.0 and above
*/

Of course, change the actual information to the right of the : with your own information.  This info must be in the main plugin file.  One thing to keep in mind is that, just like WP plugins, all sp plugin main files (and any files they include) are ALWAYS included on every WP page.  So you will want to minimize the amount of code that actually resides in the main plugin file.  Additionally, to keep sites running mean and lean, you will want to be careful to only include code, js and css when needed and not globally.

With your plugin, if needed, you can create your own admin panel for options or add your options to an existing sp admin panel.  again, existing plugins or the plugin api file can be the guide there.

If your plugin is going to have its own page view - think all forum content between the forum header and footer, ie Private Messaging or Report Post, you will want to provide a theme template file that tells how to display that page.  You, of course, cant predict what every theme will do with that template file, so the plugin should check for the needed template file (you decide the name) in the theme template file directory and use it if found. If not found, use the one you supply with the plugin.

It may also be beneficial to put actions and filters in your plugin code so other plugins can tie into your plugin and affect it if needed.

Sorry, if this seems like a lot of info!  Just trying to cover the basics and you will get used to it in no time.

Bottom line - dont hesitate to ask for help.  We dont want to write the plugin for you as that wont help us test the API, but we do want you to be successful.  If needed, we will happily add more actions and filters in the SP code to support plugin creation with a good use case.

Good luck and thanks for helping!

Avatar
cubehouse
Member
Free Members
sp_UserOfflineSmall Offline
Jul 6, 2011 - 6:50 pm

Quick tip for those using SSH or have access to grep:

grep --exclude=\*.svn\* -roEh "do_action\('([^,\.]*)'" .

will give you all the hooks in the source code (run this in simple-press folder).

Some of them are not really sensible for normal use, but hopefully it at least gives you an up-to-date half-decent list to work off.

Hooks ending with _ have varying names depending on context (i.e, variable number of hooks so each plugin can have an uninstall hook)

Example:

sph_ahah_handler_
sph_global_site_constants
sph_remove_users_cron
sm_rebuild
sph_transient_cleanup_cron
sph_stats_cron
sph_blog_scripts_start
sph_blog_scripts_end
sph_blog_support
sph_admin_menu
sph_dashboard_start
sph_dashboard_end
sph_uninstalled
sph_global_admin_constants
sph_scripts_admin_start
sph_scripts_admin_end
sph_admin_head_start
sph_admin_head_end
sph_admin_panel_header
sph_admin_footer
sph_global_forum_constants
sph_forum_constants
sph_scripts_start
sph_scripts_end
sph_head_start
sph_textwrap_css
sph_head_end
sph_footer_start
sph_footer_end
sph_setup_forum
sph_before_template_processing
sph_after_template_processing
sph_get_query_vars
sph_get_def_query_vars
sph_fill_query_vars
sph_load_editor_support
sph_load_editor
sph_plugins_loaded
sph_integration_panel
sph_integration_storage_panel_location
sph_integration_storage_panel
sph_integration_save
sph_integration_storage_save
sph_profiles_options_left_panel
sph_profiles_options_right_panel
sph_options_tabsmenus_panel
sph_profiles_avatar_left_panel
sph_profiles_avatar_right_panel
sph_profiles_options_save
sph_profiles_avatars_save
sph_components_smileys_left_panel
sph_components_smileys_right_panel
sph_components_seo_left_panel
sph_components_seo_right_panel
sph_components_ranks_panel
sph_components_messages_left_panel
sph_components_messages_right_panel
sph_components_mobile_left_panel
sph_components_mobile_right_panel
sph_components_uploads_left_panel
sph_components_uploads_right_panel
sph_components_login_left_panel
sph_components_login_right_panel
sph_components_links_left_panel
sph_components_links_right_panel
sph_components_topicstatus_panel
sph_component_smileys_save
sph_component_login_save
sph_component_seo_save
sph_component_linking_save
sph_component_uploads_save
sph_component_topicstatus_save
sph_component_ranks_save
sph_component_srank_new_save
sph_component_srank_update_save
sph_component_srank_add_save
sph_component_srank_del_save
sph_component_messages_save
sph_component_mobile_save
sph_themes_list_panel
sph_activate_theme_
sph_toolbox_environment_panel
sph_toolbox_housekeeping_left_panel
sph_toolbox_housekeeping_right_panel
sph_toolbox_toolbox_left_panel
sph_toolbox_toolbox_right_panel
sph_toolbox_uninstall_panel
sph_toolbox_error_panel
sph_toolbox_install_panel
sph_toolbox_save
sph_toolbox_log_clear
sph_toolbox_uninstall_save
sph_toolbox_housekeeping_save
sph_options_global_left_panel
sph_options_global_right_panel
sph_options_display_left_panel
sph_options_display_right_panel
sph_options_email_left_panel
sph_options_email_right_panel
sph_options_content_left_panel
sph_options_content_right_panel
sph_options_members_left_panel
sph_options_members_right_panel
sph_option_global_save
sph_option_display_save
sph_option_content_save
sph_option_members_save
sph_option_email_save
sph_option_style_save
sph_users_members_panel
sph_admin_caps_list
sph_admin_caps_form
sph_admins_manage_panel
sph_admins_options_top_panel
sph_admins_options_left_panel
sph_admins_options_right_panel
sph_admins_options_bottom_panel
sph_admins_global_left_panel
sph_admins_global_right_panel
sph_admin_your_options_save
sph_admin_global_options_save
sph_admin_update_save
sph_admin_new_save
sph_forums_add_perm_panel
sph_forums_edit_group_panel
sph_forums_global_perm_panel
sph_forums_rss_panel
sph_forums_group_perm_panel
sph_forums_global_rss_panel
sph_forums_delete_forum_panel
sph_forums_delete_perm_panel
sph_forum_create_forum_options
sph_forum_edit_forum_options
sph_forums_edit_perm_panel
sph_forums_delete_group_panel
sph_forums_create_group_panel
sph_forum_group_create
sph_forum_forum_create
sph_forum_global_permission
sph_forum_group_permission
sph_forum_remove_perms
sph_forum_perm_add
sph_forum_forum_del
sph_forum_group_del
sph_forum_perm_del
sph_forum_forum_edit
sph_forum_group_edit
sph_forum_perm_edit
sph_forum_global_rss
sph_forum_rss
sph_perm_add_perm_panel
sph_perm_delete_perm_panel
sph_perm_edit_perm_panel
sph_perms_add
sph_perms_edit
sph_perms_del
sph_usergroup_delete_panel
sph_usergroup_create_panel
sph_usergroup_edit_panel
sph_usergroup_add_member_panel
sph_usergroup_delete_member_panel
sph_usergroup_new
sph_usergroup_del
sph_usergroup_add
sph_usergroup_moved
sph_usergroup_remove
sph_plugins_list_panel
sph_tags_list_panel
sph_uninstall_plugin
sph_uninstall_
sph_uninstalled_plugin
sph_plugins_save
sph_UpdateProfileMemberships
sph_UpdateProfileSettings
sph_UpdateProfileProfile
sph_UpdateProfileIdentities
sph_UpdateProfileAvatarUpload
sph_UpdateProfileAvatarPool
sph_UpdateProfileAvatarRemote
sph_UpdateProfileSignature
sph_UpdateProfilePhotos
sph_UpdateProfileGlobalOptions
sph_UpdateProfilePostingOptions
sph_UpdateProfileDisplayOptions
sph_UpdateProfile
sph_post_edit
sph_topic_delete
sph_post_delete
sph_post_approved
sph_pre_post_create
sph_post_create
login_head
login_form
sph_quick_reply
sph_pre_editor_display
sph_post_editor_display
sph_after_memeber_group
sph_before_member_group
sph_after_member
sph_before_member
sph_after_list
sph_before_list
sph_after_post
sph_before_post
sph_BeforeDisplayStart
sph_AfterDisplayStart
sph_BeforeDisplayEnd
sph_AfterDisplayEnd
sph_HeaderBegin
sph_HeaderEnd
sph_FooterBegin
sph_FooterEnd
sph_after_topic
sph_before_topic
sph_BeforeSectionStart
sph_BeforeSectionStart_
sph_AfterSectionStart
sph_AfterSectionStart_
sph_BeforeSectionEnd
sph_BeforeSectionEnd_
sph_AfterSectionEnd
sph_AfterSectionEnd_
sph_BeforeColumnStart
sph_BeforeColumnStart_
sph_AfterColumnStart
sph_AfterColumnStart_
sph_BeforeColumnEnd
sph_BeforeColumnEnd_
sph_AfterColumnEnd
sph_AfterColumnEnd_
sph_BeforeInsertBreak
sph_AfterInsertBreak
sph_after_group
sph_before_group
sph_after_forum
sph_before_forum
sph_memberdata_update
sph_current_user_class
sph_user_class
sph_activate_plugin
sph_activate_
sph_activated_plugin
sph_deactivate_plugin
sph_deactivate_
sph_deactivated_plugin
sph_member_created
sph_member_deleted
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jul 6, 2011 - 6:57 pm

yeah, eventually we will have a codex with something about each one...

worth noting those are only hooks...  you should (please) do the same thing with apply_filters and sph

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jul 6, 2011 - 6:58 pm

oh... I would narrow that down to ones with sph in the name... some of those are wp or other...

Avatar
cubehouse
Member
Free Members
sp_UserOfflineSmall Offline
Jul 6, 2011 - 7:05 pm

Magic magic:

 grep --exclude=\*.svn\* --include=*.php -roEh "do_action\('sph_([^,]*)'" . > plugin_hooks.txt;grep --exclude=\*.svn\* --include=*.php -roEh "apply_filters\('sph_([^,]*)'" . > plugin_filters.txt;

Creates two files with the filters and hooks in. Will update list above in a sec

Avatar
cubehouse
Member
Free Members
sp_UserOfflineSmall Offline
Jul 6, 2011 - 7:06 pm

I just realised I can't update posts... List is massive anyway, hoping people can generate them themselves effectively 🙂

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jul 6, 2011 - 7:09 pm

yeah... thanks

Avatar
Lee H
Coastal New England (USA)
Member
Free Members
sp_UserOfflineSmall Offline
Jul 15, 2011 - 10:07 am

@cubehouse

Great snippet... it seems posting directly goofed up the commands a bit as I got errors.

Here's a cleaned up command with a slight change in the regex's so others can use.

grep --exclude=\*.svn\* --include=*.php -roEh "do_action\('sph_([^,]*)'\)" . > plugin_hooks.txt;
grep --exclude=\*.svn\* --include=*.php -roEh "apply_filters\('sph_([^,]*)'.*\)" . > plugin_filters.txt;

Others may prefer to use options -roEHn instead to show filenames and line numbers for easy lookup.

BTW... I'm pleased with your SVN commands in the other thread as well, nice to have these handy commands available for easy reference.

Avatar
cubehouse
Member
Free Members
sp_UserOfflineSmall Offline
Jul 16, 2011 - 6:24 am

Ah brilliant. My grep+regex magic was a little rusty that day, that's a better regex to pull just the hook names out.
Hopefully it's handy to people who are relatively new to using unix/linux commands. Are a coders best friend for getting information quickly 🙂

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Sep 25, 2011 - 4:34 pm

just for exactness, Lee your grep for the actions is not quite correct... the regex assumes there are no arguments for the do_action() call but there can be... really need to carry the regex from the filter forward to the actions...

So they would be:

grep --exclude=\*.svn\* --include=*.php -roEh "do_action\('sph_([^,]*)'.*\)" . > plugin_hooks.txt;
grep --exclude=\*.svn\* --include=*.php -roEh "apply_filters\('sph_([^,]*)'.*\)" . > plugin_filters.txt;
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 620
Members: 17365
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626