Module Login on article Joomla 2.5 - authentication

I created an article on joomla and I'd like to display a part for all(public) and another part of article only for registered users. Now I create a module that I integrated on article page, but I'd like to display the login.
Alternatively I can create 2 page: a login page that redirect to the my registered article. How can I do this?
Thanks

Or just use the built in show unauthorized feature that shows the intro but not the body to users who do not have authorization to see the article. YOu can set this globally or article by article or with a menu link.

For the login module, what you can do is, define a custom position for it by typing one in, rather than selecting one of the predefined ones, then embed it by using the following code:
{loadposition xxx} //xxx being the position you defined
Or, you can use an extensions from the Content Restriction category on JED to restrict content.
Personally, I think Hider might be your best choice, as it allows you to defines specific groups and specific content.
Alternatively, you can do it this way. Firstly, download and install Sourcerer which allows you to use any code in your articles. Then use the following code inside your article and be sure to use the {source} tags:
{source}
$user = JFactory::getUser();
if ($user->guest) {
echo "some content";
echo "Login to read more";
echo "{loadposition xxx}";
}
else {
echo "all content";
}
{/source}

Related

How can I add a custom page to Shopify without the /pages/ URL?

I want domain.com/custompage, but the built in functionality puts all pages inside a /pages/ directory so the URL comes out domain.com/pages/custompage which I don't want.
I found this answer from a Shopify Guru in 2016 that mentions potentially setting up a custom HTML template or using an app, which no longer exists.
Any clues on how to achieve this? I have limited experience with Shopify templates, but could figure it out if someone could point me in the right direction.
This blogger says it can't be done:
"Q: Can you create pages on the root? A: The answer to this is no –> all pages have either /pages/, /collections/ or /products/ in the URL."
However others have told me it is possible. Just not how to do it.
Create a section Name "test" // first a step
Create a page json Name "test" // The second step
After creating the page, JSON does a section test

block redirect link to login in joomla and add a popup instead of that

In joomla the default function if a guest clicks a link with a registered access level, is to redirect guest to the login page.
Is there a way to show a popup instead, for all of registered access level links?
For example it redirects to
your.com/login.html
But i want to show a login-button before the guest is redirected.
I found another template where it works like this, but it wont work in my own template. How can I do it in my template?
if(JFactory::getUser()->guest) {
//do user logged out stuff
}
else {
//do user logged in stuff
}
There is no simple fix. The problem is that when it is added, you dont really have information about where a link leads to. If you create an article that is public, and you add a link to an article that is restricted, then joomla does not check this when you add the link.
In the event that joomla can know this beforehand, like restricted menu items, or listing of article links in a category, restricted links will not be displayed to a guest user.
If you want to try to change the behaviour like you want to, then I would consider in what situation this actually happens. If it is links in articles that is the main problem, then the best would be if the editors, when adding links to restricted content, also added a predefined class or something to this link. Then use JQuery to disable the link and display a popup on click. A similar approach could be used in other contexts.

Jive 7: How to change profile data / action?

I am writing a plugin for Jive (SBS) 7 and want to add more data to the template for the user profile Overview page (i.e. /people/admin ). In Jive 6 I did overwrite the profile path in struts and added my own ViewProfile action. But this action seems to be called no more.
I also cannot even figure out where the templates I changed get their data from (soy/people/profile/{userProfile, header, head}.soy) or what action is responsible for.
So how can I add another property to the soy file that gets a custom property for the targetUser? (custom property = property saved in the database table jiveuserprop)
You need to create a plugin and then use the option. Then, you simply use jquery to add the extra stuff.
you can create an action that takes in information using getters or post and throw it into the user's extended properties. You can create another action that'll retrieve that info in json.
then, simply use jquery's getJson to grab the info and use selectors to show the data in the user profile.
Don't forget to use the $j(document).ready(function(){ // your code here }); to show the info
simple example:
<scipt>
$j(document).ready(function(){
$j("div#j-profile-header-details").append("<p>hello World</p>");
});
</script>
will append "hello world" under the user's email address / job title.
hope this helps. feel free to ask more questions if it doesn't make sense. here's a good link on writing the javascript part of the plugin: http://docs.jivesoftware.com/jive/7.0/community_admin/index.jsp?topic=/com.jivesoftware.help.sbs.online/developer/PluginXMLReference.html
I got an answer in the Jive Developer community:
profile is an action in Struts2. /people/username is a URL Mapper permutation
https://community.jivesoftware.com/thread/263660

How can I display Joomla modules within a component?

I have a component with several categories of games and I want to display a different banner depending on the category. I need the banner (and link) to be customizable so it's not simply a case of showing categoryX.jpg or whatever.
I saw this Joomla help page on another question, but it only seems to display a module type, not one specific module. I'd like to use various mod_custom modules and display the one appropriate to the category (I can store each module's ID if necessary).
Any ideas?
This can be done in a 2 step process:
Use the "Load module into article" plugin to allow yourself to access the module using a plugin call like:
{module [*mod_id*]} // where *mod_id* is the module id
Now that you can call a plugin to put your module anywhere, you now need to go to the view code of your/a component you wish to add the module to and add this code:
echo JHTML::_('content.prepare', '{module [*mod_id*]}');
Please see this link - http://www.alltogetherasawhole.org/group/developers/forum/topics/running-joomla-content-plugins - regarding point number 2. I was trying to do the same thing and I found it didn't work, and the reason for this was a comment you can find on the page link above:
"I noticed that some plugin actually expect option=com_content for them to process onPrepareContent properly, so you might actually want to "fool" them by callin JRequet::setVar and restoring the correct values after the trigger."
If you would like to show module within PHP code then use this code, it's worked for me :
<?php echo JHTML::_('content.prepare', '{loadposition position-2}'); ?>
If you want to show module inside html content then just put this code where you want to show module.
{loadposition position-2}
It loads all modules which are assigned to position-2.
You can also use the Joomla Module Renderer
$doc = JFactory::getDocument();
$renderer = $doc->loadRenderer('modules');
$position = 'custom_position_name';
$options = array('style' => 'raw');
echo $renderer->render($position, $options, null);
Just a heads up, Along with being assigned the module position, that module also has to be set to "Display on All pages".
Joomla has this functionality built in. You can use the {loadposition XX} command within your content items. You can specify custom module positions that do not appear in your template to insure that you have the correct module in the correct article.
http://docs.joomla.org/How_do_you_put_a_module_inside_an_article%3F
You could create a new module?
If each category appears in the querystring (catid=X) then you could take a similar approach to https://support.pillwax.com/open-source/doku.php?id=joomla:header_image.
Alternatively, that link might actually do it for you.

How do I change the default landing page in a Trac wiki?

A default Trac installation will display the WikiStart page as its home page. I'd like it to display another page. How do I do that? I was unable to find anything with Google, as any request with "Trac" in it will return links to every opensource project that uses Trac.
If you want to keep the "Welcome to Trac" page, have you considered simply migrating that content to a new page and then editing WikiStart? Trac documentation upgrades leave the WikiStart page unchanged (as documented here), so you aren't making trouble for yourself in that regard.
Are you wanting to display a different wiki page, or a different kind of page? I don't know of a config option for the former, but you can use [trac] default_handler in your trac.ini to make, say, the custom query page be the default page.
Edit: Taking a quick glance over the sources, WikiStart is pretty well hard-coded as the start page for the wiki. So, short of patching Trac, I don't think you can do what you're after.
It seems there's no hope in overriding /wiki URL path to render a wiki page other than WikiStart. That's hardcoded by design (maybe for a very good reason).
On the other hand you can use configuration options in [mainnav] section to override Wiki link in main navigation area and make it point at a custom wiki page e.g.
[mainnav]
wiki.label = Home
wiki.href = /wiki/HomePage
see details in trac:wiki:TracInterfaceCustomization#CustomNavigationEntries
If your Trac installation is behind Apache, then you can use an Apache configuration directive to redirect or rename the "home page" url. For example, look at the "Alias" directive.
My solution to the same problem was to use the [[Include]] macro (http://trac-hacks.org/wiki/IncludeMacro), and have the WikiStart page contain a single include statement.
I wanted a different page name than WikiStart so I could use the page name prefixes to categorize sets of pages, e.g., MyToolNameIntroduction is my start page.
This trac ticket suggests it is not directly possible: http://trac.edgewall.org/ticket/9012