Adding extra arguments to the url (mcp module)

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
User avatar
Alfatrion
Registered User
Posts: 166
Joined: Sat Feb 17, 2007 3:06 am

Adding extra arguments to the url (mcp module)

Post by Alfatrion » Wed Jun 27, 2018 9:07 pm

The includes/functions_module.php contains references to three module methods. I can not seem to find out how to use these functions. Could anybody help?

print $url_func gives me: phpbb_module_\{vendore}\{module_name}\mcp\main_module_url, but php does not seem to accept functions with a backslash. I have tries doubles, trippels and four in a row, but these do not work.

I am trying to do two things with mcp modes/pages:
1. Get pages to hide, when the required url parameters are not given, like this is done for the warn module when warning post.
2. Keep url parameters when going to other pages that support it.

I did find this topic
viewtopic.php?f=71&t=2314651

I am working with phpbb 3.2

Code: Select all

$url_func = 'phpbb_module_' . $short_name . '_url'; 
if (!function_exists($url_func))
{       
        $url_func = '_module_' . $short_name . '_url'; 
}       
                        
// Function for building the language name
$lang_func = 'phpbb_module_' . $short_name . '_lang';
if (!function_exists($lang_func))
{       
        $lang_func = '_module_' . $short_name . '_lang';
}       
        
// Custom function for calling parameters on module init (for example assigning template variables)
$custom_func = 'phpbb_module_' . $short_name;
if (!function_exists($custom_func))
{       
        $custom_func = '_module_' . $short_name;
}       
My abandoned (for own reference). mod: Post Rating System (website | screenshots | demo | support)

rxu
Extensions Development Team
Posts: 2845
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation
Name: Ruslan
Contact:

Re: Adding extra arguments to the url (mcp module)

Post by rxu » Fri Jul 06, 2018 5:02 pm

It is not clear what methods are you referring to and what are you trying to do exactly.
The current extension code (if you have it) would explain that.

User avatar
Alfatrion
Registered User
Posts: 166
Joined: Sat Feb 17, 2007 3:06 am

Re: Adding extra arguments to the url (mcp module)

Post by Alfatrion » Thu Jul 19, 2018 8:14 am

Thanks for you message.
I am referring to the magic functions for adding extra URL, language and custom. For one, I am traying to add extra arguments, when they are available "&c=<number>".

I have uploaded my extension to github.
https://github.com/akruijff/Penalty-Car ... module.php

These all do not work.

Code: Select all

function _penalty_cards_mcp_module_url($mode, &$module_row) {
return 'x';
}
function _akruijff_penalty_cards_url($mode, &$module_row) {
return 'x';
}
function phpbb_akruijff_penalty_cards_mcp_module_url($mode, &$module_row) {
return 'x';
}
function _akruijff_penalty_cards_mcp_module_url($mode, &$module_row) {
return 'x';
}
My abandoned (for own reference). mod: Post Rating System (website | screenshots | demo | support)

User avatar
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 24494
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: Adding extra arguments to the url (mcp module)

Post by Paul » Thu Jul 19, 2018 8:35 am

It should be a method in your class, not a normal function :).

Also, if you are planning to submit your extension to the extension database, you should read the coding guidelines, as in its current form it won't be accepted.
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

Post Reply

Return to “Extension Writers Discussion”

Who is online

Users browsing this forum: Ger and 8 guests