May be I'll just finish with this social login first. I just need to check something up in converting modification.xml to hooks whenever possible. Original modification.xml file is attached together with unfinished package for reference.
[b][u]First modification[/u][/b]
<file name="$languagedir/Modifications.english.php">
<operation>
<search position="end" />
<add><![CDATA[
// OneAll Social Login (https://docs.oneall.com/plugins/)
$txt['oasl_title'] = 'OneAll Social Login';
$txt['oasl_config'] = 'Configuration';
$txt['oasl_settings_descr'] = 'OneAll Social Login Settings';
$txt['oasl_user_does_not_exist'] = "<strong>This social network has not yet been linked to an account.</strong><br /><br />Please use the registration form to create a new account. If you already have an account, open your profile settings to connect the social network to it.";
$txt['oasl_user_may_not_register'] = 'Sorry, but the admistration has disabled the registration for new users.';
$txt['oasl_user_require_activation'] = 'Your account has been created but it needs to be verified. Please check your mailbox and click on the link in the verification email.';
]]></add>
</operation>
</file>
The first modification is to add languages for the addon settings itself, so I will move the texts are move to the language file and load it via integrate_admin_areas. This will be done together with the fourth modification that will add menu in admin page.
[b][u]Fourth modification[/u][/b]
<file name="$sourcedir/Admin.php">
<operation>
<search position="after"><![CDATA['layout' => array(
'title' => $txt['layout_controls'],]]></search>
<add><![CDATA[
// OneAll Social Login (https://docs.oneall.com/plugins/)
'oasl' => array(
'title' => $txt['oasl_title'],
'permission' => array('admin_forum'),
'areas' => array(
'oasl' => array(
'label' => $txt['oasl_config'],
'file' => 'Subs-OneallSocialLogin.php',
'function' => 'oneall_social_login_config',
'custom_url' => $scripturl . '?action=admin;area=oasl;sa=settings;sesc=' . $sc,
'icon' => 'server.gif'
)
)
),
]]></add>
</operation>
</file>
For the time being the menu will be put under members areas. The above two modifications will be in 1ASL.subs.php as follows:
function 1ASL_AdminMenu(&$menudata)
{
global $scripturl, $txt;
// Load language(s)
loadLanguage('1ASL/1ASL');
// Insert 1ASL inside layout menu instead of having its main admin menu.
$menudata['members']['areas'] = array_merge(
array(
'oasl' => array(
'label' => $txt['oasl_config'],
'file' => '1ASL.subs.php',
'function' => '1ASL_config',
'custom_url' => $scripturl . '?action=admin;area=oasl;sa=settings;sesc=' . $sc,
'icon' => 'server.gif' ,
'subsections' => array(
),
),
),
$menudata['members']['areas']
);
}
The second modification can be converted to hook but the third one seems not possible to the same so it will stay as it is.
[b][u]Second and third modification[/u][/b]
<file name="$boarddir/index.php">
<operation>
<search position="before"><![CDATA[
'editpoll2' => array('Poll.php', 'EditPoll2'),]]></search>
<add><![CDATA[
'oasl' => array('Subs-OneallSocialLogin.php', 'oneall_social_login_config'),
'oasl_registration' => array('Subs-OneallSocialLogin.php', 'oneall_social_login_registration'),
'oasl_callback' => array('Subs-OneallSocialLogin.php', 'oneall_social_login_callback'),]]></add>
</operation>
</file>
<file name="$boarddir/index.php">
<operation>
<search position="after"><![CDATA['coppa', 'login',]]></search>
<add><![CDATA['oasl_registration', 'oasl_callback', ]]></add>
</operation>
</file>
I think in 1ASL.subs.php, as a hook using integrate_actions, the second modification should look something like this:
function 1ASL_Action(&$actionArray, &$adminActions)
{
$actionArray = array(
'oasl' => array('BOARDDIR/addons/1ASL/1ASL.subs.php', '1ASL_login_config'),
'oasl_registration' => array('BOARDDIR/addons/1ASL/', '1ASL_login_registration'),
'oasl_callback' => array('BOARDDIR/addons/1ASL/', '1ASL_login_callback'),
);
return $actionArray;
}
I am not so sure about the fifth modification below:
[b][u]Fifth modification[/u][/b]
<file name="$sourcedir/Load.php">
<operation>
<search position="before"><![CDATA[// Some basic information...
if (!isset($context['html_headers']))
$context['html_headers'] = '';]]></search>
<add><![CDATA[
// OneAll Social Login (https://docs.oneall.com/plugins/)
if ( ! empty ($modSettings['oasl_api_subdomain']))
{
$context['html_headers'] .= "\n<!-- OneAll.com / Social Login for SMF //-->\n";
$context['html_headers'] .= '<script type="text/javascript" src="//' . htmlspecialchars ($modSettings['oasl_api_subdomain']) . '.api.oneall.com/socialize/library.js"></script>';
}]]></add>
</operation>
</file>
I am thinking to load this as early as intergrate_pre_load or during integrate_theme_load. May be the later is more appropriate.
function 1ASL_PreLoad(&$actionArray, &$adminActions)
{
global $context, $modSettings;
if (!empty($modSettings['oasl_api_subdomain']))
$context['html_headers'] .= '<script type="text/javascript" src="//' . htmlspecialchars ($modSettings['oasl_api_subdomain']) . '.api.oneall.com/socialize/library.js"></script>';
}
Just few more lines to be converted and then finish this up for a good test. Any supports, feedbacks and comments on the above and other converted files are appreciated.