Overwrite Authentication Type's form.php in a Package - concrete5

I am trying to overwrite the form.php file for the 'concrete' authentification type. I can make it work if I place the form.php file in the /application/authentication/concrete directory, but not from within my theme package directory.
<?php foreach ($activeAuths as $auth): ?>
<div data-handle="<?= $auth->getAuthenticationTypeHandle(); ?>" class="authentication-type authentication-type-<?= $auth->getAuthenticationTypeHandle(); ?>">
<?php $auth->renderForm($authTypeElement ?: 'form', $authTypeParams ?: array()); ?>
</div>
<?php endforeach; ?>
If I try to load another form (by replacing the second parameter in the renderForm method) nothing happens.
Any ideas how to make c5 aware of the override?

You can't. I have developed a package that needed to do that and it can't be overridden from a package. You have to do it from the application directory.
My package has an "install" option that copies the modified form from the package's directory to the application one.

Related

WordPress Calling Function Outside

How to get value using
<?php get_theme_mods('emailaddress') ?> in file insde theme folder?
Actually I have registered a field to set email from WordPress customize section. <?php get_theme_mods('emailaddress') ?> is working fine when I display on WordPress pages or posts but it does not work when I try to get value on formhandler.php file inside theme folder.
When form is submitted, the form calls the file formhandler.php inside theme folder. So, I want to get value using <?php get_theme_mods('emailaddress') ?> to use email sent to email.
Why is <?php get_theme_mods('emailaddress') ?> not working inside formhandler.php file? This file just process the form and sends email.
Include wp-load.php at the top of formhandler.php. You will find wp-load.php in the root. If formhandler.php is on the root of your active theme then use the following include statement.
<?php include '../../../wp-load.php'; ?>

Get current user name in WordPress theme (3.2)

I'm creating a WordPress theme, but I can't get the current username. I tried get_currentuserinfo() but it doesn't seem to work. Is there any working function to get the username that I can use in the header.php template file?
Did you read the documentation, this example work well for me :
<?php
global $current_user;
wp_get_current_user() ;
echo $current_user->user_login;
?>

drupal_set_message not working on one specific template?

I have one specific template which drupal_set_message() does nothing on. The $messages are printed out in a header include which also exists on this template. I've triple checked that it's using the template I think it is, etc.
The only difference I can tell between this and any other page template I'm using is that this is a node-specific template. Specifically page-node-170.tpl.php.
Anyone have any ideas?
Make sure that the custom template (page-node-170.tpl.php) has the following lines somewhere visible:
<?php if ($show_messages && $messages): print $messages; endif; ?>
<?php print $help; ?>

custom wordpress page

I'd like to implement a custom post retrieval page in wordpress. Basically, I'm using AJAX to call this page that will be passed a post ID and retrieve certain data from that post.
Note: please don't mistake this as a template question. I do not want a template for one single page -- I am looking to make this page query multiple different posts based on postID and return certain data from that post.
So I tried creating a page
<?php
$args=array(
'p'=>'77'
);
$friends = new WP_Query($args);
?>
<?php if ($friends->have_posts()) : the_post(); ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php else: ?>
<p>Sorry, no posts are available.</p>
<?php endif; ?>
But this does not work since it is not loading in the wp functions to handle the query.
Thanks in advance for any help!
You have to include the wp-blog-header.php file. If the page you are creating is in your theme's folder then you would put something like this at the top of your code
<?php require_once ('../../../wp-blog-header.php');?>
I think I guess what you are trying to do, and it sounds like you are going about it the wrong way. Do not make a 'new page' in the admin interface. What you want to do is serve up a file (JSON, XHTML fragment, whatever) to your Javascript and include in it WP data, right? I know that problem, having used it in some of my plugins.
There are two techniques:
(1) This is what you need to do: make a new plugin (just a loose php file in wp-plugins with the same format header as the other plugins in there). Write your function along these lines:
function mydatapage(){
if (...$_SERVER['REQUEST_URI'] == the one I am using ...) {
$args=array(
'p'=>'77'
);
$friends = new WP_Query($args);
if ($friends->have_posts()) :
the_post();
the_title();
the_content();
else:>?
<p>Sorry, no posts are available.</p>
<?php endif;
die();
} //else do nothing and leave WP to serve the page normally
}
//Crucially:
add_action('init', 'mydatapage');
What that does is do a lookup when pages are loaded to see if the url matches the one you want to hijack and use to send your custom data. If it is, you send the data/file/whatever you feel like and exit (die).
Give a shout if you want more detailed syntax. It is a bit messy, but works well.
(2) Directly call your plugin file. WP will only handle files that do not already exist, and leave the rest to Apache. That means you can make a plugin file and call that directly using the .../wp-plugin/myfile.php url. You would need to include some of the WP core files to get things like WP_Query to work. It is marginally more fragile a method.

Drupal is allowing viewing of unpublished content

I inherited a Druapl5 site and it's showing content when published is not checked in the Publishing Options section of the Edit Content Form.
I confirmed that the status is 0 in the DB for the node. So it should be not visible.
My first guess was that I was logged in and that's why I could see it, but I logged out and I could still see it. I tried a different browser and the same thing so it's not that.
Also, the unpublished nodes are coming up in the search results which I originally thought was an out of date search cache, but may be something different.
Ever seen anything like this? Any ideas?
You mentioned in a comment that Content Access is installed on the site. This module (as well as several others, e.g. ACL) overrides the default Drupal node access mechanism in order to provide additional/more fine grained permission settings.
So my guess is that the permission configurations in that Module are configured wrong for your desired results. As far as I recall, it allows separate permission sets per content type (defined for authors and roles). You should look at your content type edit/definition pages - there should be a tab added by that module to configure the permissions. Also check the readme.txt of the module, as it might give some additional hints.
If that does not help, you should check if other node access modules are installed as well. As mentioned, there are quite a few of them, and their interactions are not easy to determine (One should aim to use only one, if possible).
Are you using Views? If so, make sure you have a filter set to show Published only.
I ran in to a similar problem with comments, which lead to some excellent spamming opportunities until I discovered it.
Rather strange. No answers, only guesses:
Try accessing admin/content/node-settings and click on Rebuild permissions.
And maybe clear the cache admin/settings/performance
Check your permissions for anonymous users. Seems like somewhere they have the wrong permisions.
All access modules override the default settings while using hook_node_access(). Most likely this is the problem. So you need to tweak those settings in the content access portion.
And this is not the best solution. But if you need something in the interim you can always put this code in the node.tpl.php file:
if(!$node->status && $user->uid != 1){
with code added:
<div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?> clear-block">
<?php print $picture ?>
<?php
if(!$node->status && $user->uid != 1){
?>
<?php if ($page == 0): ?>
<h2><?php print $title ?></h2>
<?php endif; ?>
<div class="meta">
<?php if ($submitted): ?>
<span class="submitted"><?php print $submitted ?></span>
<?php endif; ?>
<?php if ($terms): ?>
<span class="terms"><?php print $terms ?></span>
<?php endif;?>
</div>
<div class="content">
<?php print $content ?>
</div>
<?php
if ($links) {
print $links;
}
}//if for published node
?>
</div>

Resources