Skip to main content
Topic: Profile Actions Menu / Paid subscriptions (Read 2979 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Profile Actions Menu / Paid subscriptions

Go to profile, click on "Actions" in the menu. It goes to paid subscriptions. Paid subscriptions aren't setup on this site. So, instead of going to paid subscriptions or even showing it, shouldn't it hide that? Also, why have paid subscriptions under "actions?" Seems like the menu title is wrong.

Re: Profile Actions Menu / Paid subscriptions

Reply #1

I was looking into that.
The main issue is that the error is shown only after all the gateways are loaded, that means to hide the menu entry we'd have to load all the gateways on each page of the admin panel (i.e. include all the files, load up all the instances of the gateways and check if they are properly configured).
A bit too much I think just for a menu.

Though, this may be a thing to fix in 1.1, following the schema I used for all the other actions, so: save the "ready" gateways in a settings entry and load only those configured. That way, it the settings entry is empty it means no gateways are properly configured and the menu can be hidden with just a !empty.

ETA: regarding the position... I don't like the entire organization of the profile menu... :-\
Bugs creator.
Features destroyer.
Template killer.

Re: Profile Actions Menu / Paid subscriptions

Reply #2

Without looking, why can't it just look to see if there are any gateways setup?

Re: Profile Actions Menu / Paid subscriptions

Reply #3

Yes, it can, it just have to load all the gateways every time...
The code looks something like this (personal random interpretation):
Code: [Select]
$gateways = findGateways('Gateway-*.class.php');
$available = array();
foreach ($gateways as $name)
{
    require_once(SUBSDIR . '/' . $name . '.class.php');
    $instance = new $name();
    if ($instance->isSetup())
        $available[] = $instance;
}

if (empty($available))
    fatal_lang_error('no_gateways');
So it would mean add that processing to the profile menu.
Bugs creator.
Features destroyer.
Template killer.

Re: Profile Actions Menu / Paid subscriptions

Reply #4

The result of $available isn't stored in settings?

Re: Profile Actions Menu / Paid subscriptions

Reply #5

Nope, it's checked live every time.
Adding it to a setting is more or less what would be necessary.
Bugs creator.
Features destroyer.
Template killer.

Re: Profile Actions Menu / Paid subscriptions

Reply #6

Seems simple enough.
Code: [Select]
if (!empty($modSettings['payment_gateways'])) { // show payment gateways }

Also, there is the issue that payment gateways is under "actions." Doesn't seem like an action. Seems like the language string is wrong.