Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

conf/app.user.config.php vs apps/user/conf/config.php

edited December 2013 in Framework

What's the difference? Where should overrides go?

Also, is it possible to use a custom handler/view for user/admin? I don't see the override code in apps/user/handlers/admin.php

Comments

  • We're moving to having all custom settings in the conf/app.* files, since those will automatically override anything in the apps/*/conf/config.php files.

    However, I just pushed a fix so you can mix hand-coded settings and the settings generated by Elefant's settings forms (see Tools > Blog Posts > Settings or Tools > Users > Settings for examples) and Elefant won't wipe your hand-coded settings when it updates its own. If you pull the latest from the master branch first, then you should be able to edit those files all you need without it clobbering anything on you.

    And there isn't a setting for overriding user/admin, only the ones found in apps/user/conf/config.php. You can add one like this:

    1. Add these lines to apps/user/handlers/admin.php:

    // Check for a custom handler override
    $res = $this->override ('user/admin');
    if ($res) { echo $res; return; }
    

    2. Add the following to conf/app.user.config.php:

    [Custom Handlers]
    user/admin = myapp/useradmin
    

    I usually start by copying the original handler over to my new file, removing the override lines from step 1, then customizing as needed from there. Hope that helps.

  • Thanks! I had actually done all that, but I hadn't changed echo $tpl->render ('user/admin', array ( to echo $tpl->render ('myapp/admin', array ( in the handler.

    Would you be willing to add the override code to apps/user/handlers/admin.php so that future upgrades don't overwrite it?

  • I'm a little hesitant to open up the admin-facing pages to customization at that level, since it can easily lead to breaking a site. Generally I'd prefer to look at the proposed changes and see if they wouldn't be appropriate to include directly into the existing user/admin handler. What do you have in mind?

    Using Elefant's new command line updater (./elefant update), it should respect customizations that you've made without wiping them out, since it's based on applying patches using the command line diff and patch commands. If a patch can't be applied without conflicts, it simply reports that it couldn't automatically update so you can merge the patch manually with any customizations.

  • Probably sortable columns; also I want to add links from the user table to reviews the user has written. (It's a review site.) ie, in the view, <a href="/reviews/admin?user_id={{ loop_value->id }}">{"Reviews"}</a>

  • Sortable columns would be good to add to the core CMS. For additional links (I'm assuming your Reviews link would sit next to the Edit and Delete links), maybe that's something we can make customizable without having to replace the entire handler... I'll have to think on that some more.

  • edited December 2013

    Sounds good. Yes, I have the link next to Edit and Delete. I've been adding similar links any time there are related tables (ie categories -> show products in this category). It seems like there might be a way to define related tables and then have elefant show links as appropriate.

  • I'm a little confused. In order to disable google and openid logins I had to edit both files commenting on these two lines of code:

    ;login_methods[] = openid
    ;login_methods[] = google
    

    How so?

  • If you uncheck the login methods in Member Settings, doesn't that disable them?

  • Yes, excuse me, I had just forgotten about Member Settings. Sorry.

  • No problem :)

Sign In or Register to comment.