MyBB Community Forums

Full Version: ougc Pages
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9
I think @GodLess101 comment is valid.

Regardless, if anyone finds this request useful I did add a new example file that achieves this.
https://github.com/Sama34/OUGC-Pages/blo...Fields.xml
(2020-10-26, 11:27 PM)bhuto Wrote: [ -> ]and sir one more question how can i make custom profile field to upload image.

This is not possible, but I plan to code such a plugin on the future.
not a bad plugin but a couple of issues 

1) set a page to viewable by all and add to usercp
2) load the site as a guest
3) follow the link to the category e.g pages.php?category=test-2
4) navigation has an added link to the user cp, which of course a guest doesn't have and if clicked returns the no permissions page, maybe this needs to be removed if the user is a guest ? 

I have a plugin that alters the navigation to my liking which works with all core mybb code using the start hook, I noticed pages.php has a hook so my plugin added a hook to ougc_pages_start .. this fails. if required I can supply the plugin code to view but to be fair all it does is alters $navbits[0] url/desc to a setting (this is done using the global_end hook and as expected is altered to the supplied values) there is then another hook call in the plugin to *_start hooks like so
$plugins->add_hook('global_end','df_end');
$plugins->add_hook('page_start','ge_end');
$plugins->add_hook('forumdisplay_end','jr_end');
$plugins->add_hook('index_start','jr_end');
$plugins->add_hook('showthread_start','jr_end');
$plugins->add_hook('portal_start','jr_end');
$plugins->add_hook('online_start','jr_end');
$plugins->add_hook('modcp_start','jr_end');
$plugins->add_hook('calendar_start','jr_end');
$plugins->add_hook('search_start','jr_end');
$plugins->add_hook('search_results_start','jr_end');
$plugins->add_hook('memberlist_end','jr_end');
$plugins->add_hook('member_profile_start','jr_end');
$plugins->add_hook('usercp_start','jr_end');
$plugins->add_hook('polls_start','jr_end');
$plugins->add_hook('private_start','jr_end');
$plugins->add_hook('reputation_start','jr_end');
$plugins->add_hook('misc_start','jr_end');
$plugins->add_hook('editpost_start','jr_end');
$plugins->add_hook('search_do_search_start','se');
$plugins->add_hook('contact_start','jr_end');
$plugins->add_hook('stats_start','jr_end');
$plugins->add_hook('ougc_pages_start','jr_end');

which then alters the $navbits array to finish off the total navigation. this is no real biggie as long as you add/edit
global $navbits;
$navbits[1]['name'] = 'Mod CP';
$navbits[1]['url'] = $mybb->settings['bburl'].'/modcp.php';
$navbits[2]['name'] = '<span class="s_name">'.$page['name'].'</span>';
$header = str_replace('<navigation>', build_breadcrumb(), $header);
  
to the top of the template as you can see from the code I am styling the navigation via the plugin doing manual for a few pages is a bind but do able as long as I remember to add/edit the code
Hi, I did push an update to the develop branch, I did add a new hook, ougc_pages_global_end, that should work for you, but please note that plugins that were activated before OUGC Pages may fail to use this hook.

I also did add the code to hide the UCP link if the user has no permission to view the panel.
https://github.com/Sama34/OUGC-Pages/com...c17c1e1a22
great that works, but there is a revision I would perhaps make :-
if(empty($navbits))
	{
		$navbits = [
			0 => [
				'name' => $mybb->settings['bbname_orig'],
				'url' => $mybb->settings['bburl'].'/index.php'
			]
		];
	}

in the above code you have forced $navbits[0][url] to index.php with a whole bunch of custom pages you may want $navbits[0] to be totally customisable (this is what my plugin does) so the navigation just runs around on whatever you decide. As my home page is a custom OUGC/Pagemanager page the simple answer for me was to set [url] to $mybb->settings['bburl'] and change the htaccess DirectoryIndex to point to that page. Elsewhere on the site I have set $navbits[0] to something totally different to give the impression of the user being on a different site, this area being made up of custom pages.
Hi, your suggestion to remove the index.php string is sound, but I decided to replicate the core.

However, the hook I did add should help you to overwrite it, doesn't it?

I suppose being able to set a custom page as the main navbit could be useful, but that isn't a current feature of the plugin.
(2020-11-05, 07:55 AM)Omar G. Wrote: [ -> ]Hi, your suggestion to remove the index.php string is sound, but I decided to replicate the core.

However, the hook I did add should help you to overwrite it, doesn't it?

I suppose being able to set a custom page as the main navbit could be useful, but that isn't a current feature of the plugin.

There is no need to set the main navbit in your plugin as mine does it and can be used in conjunction with yours
(2020-11-05, 07:55 AM)Omar G. Wrote: [ -> ]Hi, your suggestion to remove the index.php string is sound, but I decided to replicate the core.

However, the hook I did add should help you to overwrite it, doesn't it?

I suppose being able to set a custom page as the main navbit could be useful, but that isn't a current feature of the plugin.

using 
$plugins->run_hooks('ougc_pages_global_end');
 in my plugin does not find the hook even after enabling & disabling both plugins .. mind you I didn't realize you can add a hook to a plugin .. cool feature
Pages that load at init do load during the plugins load process, which means any plugin that isn’t loaded before this plugin is loaded won’t load at all as the page will stop the script execution.

This can be worked around by enabling your plugins before this plugin, so they load before. Or simply disabling and enabling this plugin alone, which would probably be the best approach as other plugins might perform template edits, etc.

This is one of the major downsides with loading pages at init, as there is little more to load apart from plugins when they are rendered as you can see in the following link.
https://github.com/mybb/mybb/blob/2408f4...t.php#L239

I should probably look into improving the pages.php file to load pages only after all init code was executed, opposed to how it works right now where that file is not used for pages loaded at init.

That would certainly be desirable at some point.
I should probably add the option to load at both global_start and global_imtermediate as there might be other desirable data to load. Probably dropping or discouraging the init usage which was mean to be used to load simple pages with as little resources as possible (i.e: the signature stats image example page).
Pages: 1 2 3 4 5 6 7 8 9