Jump to content

Creating a Plugin to add custom icons to Forums


Greg Rice

Recommended Posts

Posted

I've been working my way through the Plugin documentation, but it's not very comprehensive. Can someone offer some advice/tips about how to approach creating a Plugin that allows for Admin users to upload their custom icons into some sort of a library, and then for users to be able to assign one of the icons to a specific thread?

As I understand it, I need to:

Create Theme Hooks (front: forums): One for where the icon is chosen by the thread starter, and another for where the chosen icon will appear.

Create a Setting to allow admin to upload new icons.

Then create database columns to store the icon and topic IDs.

Finally create a Code Hook to read and write all the above.

Is that about right?

It seems to me that creating a new table for the icon library might be in order, but it's not clear from the documentation how this might be done?

Posted
1 minute ago, Greg Rice said:

Create a Setting to allow admin to upload new icons.

Then create database columns to store the icon and topic IDs.

Best way to go is extend \IPS\forums\Forum::form() to add a new tab. Example:

	/**
	 * [Node] Add/Edit Form
	 *
	 * @param	\IPS\Helpers\Form	$form	The form
	 * @return	void
	 */
	public function form( &$form )
	{
		$data = parent::form( $form );

		$form->addTab( 'icon_lang_bit' );
		$form->add( new \IPS\Helpers\Form\Upload( ..... );

		return $data;
	}

	/**
	 * [Node] Format form values from add/edit form for save
	 *
	 * @param	array	$values	Values from the form
	 * @return	array
	 */
	public function formatFormValues( $values )
	{
		//process the field, if necessary.

		return parent::formatFormValues( $values );
	}

That would create  a new tab, like:

Capturar.png

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...