Ogri's Playground - ogri.me | Joomla 3: Redirect to same page after successful loginOn the site, authorization occurs through the mod_login module. In the module settings, the option Login Redirection Page is set to Default. After entering the correct username and password, however, Joomla redirects to a variety of places, depending on which extension owns the currently active page. Sometimes it redirects to the site root, other time to a category blog. It's inconvenient. When a user exits (redirection option is also Default), the page does not change, everything is good.

I had to dig around and find a place in the code where the redirect is implemented. It was found not in the authorization module, but in the com_userscomponent. Namely, in the file components\com_users\controllers\user.php. And a small change in its code resolved the issue.

The login() function has been modified. Here is the original one:

public function login()
{
  $this->checkToken('post');
 
......................
 
  $app->redirect(JRoute::_($app->getUserState('users.login.form.return'), false));
}

And now look at the changed one.

public function login()
{
  $this->checkToken('post');
 
......................
 
//comment out default redirect
//  $app->redirect(JRoute::_($app->getUserState('users.login.form.return'), false));
 
//redirect to the same page
  $return = $input->get('return', '', 'BASE64');
  $return = base64_decode($return);
  $app->redirect(JRoute::_($return, false));
}

As you can see, the last line is commented out and three new lines have been added instead. The logic is taken from the next function, logout().

It is unclear what prevents the developers from fixing this discrepancy. Perhaps it, like many others, will be fixed in Joomla 4.

The issue in the title not so rarely arises before the owners of Joomla sites. Now you need to add your own text, now to change the clumsy or uninformative (and quite often - full of mistakes) text compiled by the developers of third-party extensions. There is a fairly intelligible interface for overriding the constants in the Language Manager of the site's administrative section (Solution 2), and one can actually be content with it. But if you, like me, are interested in thoroughly understanding the language structure of Joomla, then this article is for you.

In the article about replacing the outdated captcha of JComments component with reCAPTCHA v2 (NO CAPTCHA) from Google, changes in the component code are described. Herewith, since this new captcha does not require entering the alphanumeric code from the image, it was also necessary to replace the error message.. The original English message was loaded from the language file of the component by a constant:

ERROR_CAPTCHA="Please enter security code displayed in the image!"

The new text, in full accordance with Google's, should be this: "Please verify you're not a robot!".

In terms of solving this seemingly simple task, I will try to sort out all the details of working with language constants. We will consider alternative solutions and state the logic of choosing the final one.

Solution 1. At the template level

Before we go directly to captcha, let's make a short tour into the theory and review the structure of language folders and the format of language file names.

i'm not a robot i'm robert

Briefly about the events that led me to the idea of the subject. I originally used kcaptcha - the native captcha of the JComments component. At some point, I turned this captcha off as it has annoyed commentators. Immediately a lot of spam started to appear in the comments. I started using CleanTalk - a nominally paid (just $9 a year) plug-in that protects from spambots not only comments, but also login/registration, contacts and forms of many third-party extensions. Spam has ceased, but recently spammers began posting garbage comments, disguised as normal ones and even containing article headers in their text. CleanTalk cannot filter them out yet. 4-5 such "comments" began to arrive every day - not very critical, and they can be easily deleted right from notifications in the mail. But still I wanted to find a compromise solution to the problem - a captcha which will block the spam not catched by CleanTalk but at the same time not irritating potential commentators.

NO CAPTCHA reCAPTCHA from Google (or just reCAPTCHA v2.0) fits perfectly. Starting with Joomla 3.4, the second version is included in the reCAPTCHA plugin that comes with the CMS. At the time of this writing, almost two years have passed since that release, but JComments developers still do not support this plugin in their component. This does not deprecate its merits - JComments was and remains the best free solution for comments on Joomla-site. Moreover, it's quite easy to integrate the subject into the comments on your own. To do this, you need to perform a number of simple actions.

In the introduction to the guide on filtering content by articles, categories and components, I mentioned that to selectively bind the latest comments module to particular pages, it is required to create a certain number of copies of this module. On a site that is quite branched in structure and subject matter, and especially if the site is multilingual, this number can reach dozens. Each copy has its own settings specified in the Module Manager. If you need to change any parameters in all or even a few copies of the module, you will have to work painstakingly and tediously in the admin section opening a page of each copy and making manual changes. You can, of course, combine comments on several related topics into a single module, But is it not better to find a flexible solution that allows you to accurately filter out comments on each topic or even a subtopic, while at the same time reducing the number of copies of the module to a minimum, or even to a single one? It seems to me that I found such a solution, and this solution is based on the knowledge of the structure of application pages internal links generated by the Joomla engine.

As you know, Joomla modules are linked to menu items. In the case of mod_jcomments_latest, a binding to components is also introduced. There is also additional filtering by categories, but exclusively for the case when ONLY com_content is selected in the list of components. Accordingly, you need a separate copy of the module for each category of the basic Joomla component, as well as for each additional application. Within the copy, you can combine the com_content categories or a number of components. It is not possible to merge, for example, comments to categories and comments to applications other than com_content, into a single block. My method allows to distinguish between comments to categories and individual articles of com_content and at the same time - comments in other components and their structural elements; and all that - within the single copy of the module. Let me explain the principle of such a flexible filtration in detail and with examples.

Some time ago I created a number of articles about embedding of Social Media Buttons in a site running Joomla 2.5. After switching to 3.x (at the moment of writing this site works at 3.4.4), I continued keeping buttons of share42 in pages of my articles, they were integrated using the same methodology and up to certain moment everything was working well. But recently when sharing in some social networks I ran across some bugs. For example, earlier when trying to share on Facebook I had an option to choose one of the pictures available on the page. Now this option no longer exists, the picture was being chosen by Facebook script at random. I had to investigate changes in Zuckerberg's policy and adjust accordingly. This article is devoted to those investigations.

But first I updated script from share42 and found out it was dated May 2014. At that time I was still using October 2013 version. Script was changed to the fresher one but issue remained. In the JavaScript code I found an event triggered by clicking on FB button which opens the "Share" window. I figured out that the sharer.php service is called. Before its calling, a query string is generated, and this query string consists of several parameters: url, title, summary (description) and the images[] array. The last parameter–array was forming picture choice in a dialogue.

Facebook has changed set of parameters for sharer.php. All links apart from the link to the shared page were dismissed. The current processing of the button click event should look like this:

In gides about binding of Social Media Buttons and Breadcrumbs to certain pages of a Joomla-based website, only filtering by articles was considered. But what if you want to bind a module or other extension, and in general - any piece of code to the selected categories, components and their specific pages, or even to all listed at once? You may say that the modules are already linked to menu items, and in case of using more advanced module manager (eg, Advanced Module Manager) - even to categories, articles, users, components, etc. This is true; but to output module with different settings on the corresponding pages, you will have to create its multiple copies, linked to these pages. For example, on this website the Recent Comments module displays a list of comments made to articles of only those categories and components whose pages output this instance of module. Since the structure of the site is quite extensive, and besides, the site is multilingual, number of copies of the module exceeds 10. It's pretty inconvenient.

The proposed solution is intended to provide a flexible and contextual content output based on specified criteria. Coding knowledge is desirable, but I will try to give exact recommendations for its implementation, which will allow less qualified Joomla users to also utilize this methodology. In addition, in a separate article I have described the structure of internal links within Joomla site, which is designed to facilitate the understanding of the algorithm. Let's do it!

Recently I wrote and implemented several functions that allow you to filter the pages output of the website running CMS Joomla version 2.5 and later. Before sharing them with the public, I will touch on the subject posed in the title of this article, as the principle of formation of internal links to Joomla application pages will help to better understand their algorithms.

A bit of theory

Applications for the CMS Joomla are being developed as components. Components are responsible for the pages output. A link to each page is generated in the respective component in the standard URI format:

http://[site name]/index.php?[query string]

The query string is a sequence of key=value pairs separated by an ampersand. Keys' values just determine the output of each page. URI of pages are generated in accordance with the structure of the component. Currently we are not interested in the mechanism of these links formation, but the result for each page or group of pages of the application will be important. Knowing how to identify keys and their values, you can flexibly operate on the output of the page content.

In a previous article I described the process of transferring content from source site to destination site and integration it as a separate section into the destination site structure. Component J2XML accomplished the task well enough. I would rate it "excellent", but, as noted later in that article, its functionality does not include the transfer and integration of menu structure. However, it did not take long to manually reproduce it on the site-receiver. But when I started to bind menu items to the corresponding elements of content, I have encountered with a certain problem. It is in the process of solving I got acquainted for the first time in my practice with the option placed in the title of this article.

Let me describe the problem. The source site has several menus. The need is to place them at the destination site in the same form - as separate modules, but since the new content is conceived to be a separate section, all sub-sections must include the name and alias of the parent section - in the URL and the breadcrumbs. But the menus, corresponding to the sub-sections, should remain the root level menus. However, if the second condition is satisfied then the first one is not. This is where the option of choosing menu item type as an alias of another menu item became helpful.

The logic of the problem appearance becomes clear when I will illustrate it with particular example. For greater clarity, I will replace narrow subject of my site with more popular one - namely cars. I hope that ladies forgive me for the theme, usually more interesting for gents )).

Not long ago I had another site in addition to this one. For some reason I decided to join that second site to this site as a separate section. Besides, that other site appeared even earlier and had several hundred articles, divided into a dozen of categories, as well as about fifty registered users. There was not less info on this site by the time. Objective: to transfer content to another site so as to create a unified structure.

I found an excellent component J2XML, created just for such a task. It's free and has flexible settings. It exports related structure of articles, categories and users from a donor site and integrates it into the structure of an acceptor site. It can also transfer pictures in articles as well as WebLinks. The transfer, as its name implies, is carried out through XML-files. The goal of this article is detailed examination of settings and functionality of the component J2XML.

As I noted in an article about editing of animated GIFs, I am not an expert on Photoshop. However, having examined some image processing scenarios I successfully use them. For example, when I opened galleries of two nearest and dearest to me young artists here on the site, I had attended to the method submitted in the headline of the article. Will describe the problem more clearly.

Initially: there is a photograph of a painting. In its original form, it does not suitable for posting on the website:

ogri.me | Photoshop: Processing photos of paintings for online gallery #01

Expected result:

ogri.me | Photoshop: Processing photos of paintings for online gallery #02

Sequence of operations allowing you to transform former into the latter is being put to the agenda today. Screenshots are clickable.

Subject in the headline of this article had been seemingly described and discussed in the web many times. Nevertheless, as it often happens, the information in each source is incomplete. The overall picture is composed of disparate information, and some particular glitches which I encountered are not covered at all - at least I have not found such coverage and came up with my own solutions. Therefore, the purpose of this article (and all others) - to bring together information from different online sources, to structure it, supplement with my own experience and pass into judgement of the Internet community.

Breadcrumbs, also known as site navigator, is useful Joomla module. And, as every module, it can be linked to all or only certain menu items. It is also possible to unlink this module from all or specific items. Many Joomla website owners wish to hide navigator on the home page, since it contains only one item "Home" with no link and does not incurs thus any functional load. Perhaps the site structure also provides other pages on which, for whatever reasons, it makes sense to hide navigator. The most typical example is a custom 404 error page, which, as I emphasize in the corresponding article dedicated to the rules of its creation and configuration, should fit into a site template, but at the same time to be by itself. Navigator on page 404 is not only unnecessary, but also ideologically harmful. We will consider this particular page as a special case, which describes the general principle of unlinking breadcrumbs from certain article.

While writing an article about the customization of page 404, I raised the issue of how to get rid of unwanted items in a page interface. Another article is devoted to the selective hiding of the breadcrumbs module. I also came to the conclusion not to display social buttons on page 404. There are other cases where it's worth to hide social media icons on certain pages, or vice versa - to display them only on some. Arranging articles of this series, I just faced a similar need: some button panels are displayed for illustration only in the relevant articles. So I decided to add this topic to the series.

In previous articles you learned how to insert a horizontal bar of social buttons into the article body. We now consider the option to hang vertical "floating" buttons panel to have it at any site page. The same service share42.com will help in this. Generate the panel template same way as in case of horizontal option, but the type of panel with icons choose this time - vertical "sticky".

After localizing files and places where scripts of social button panels are inserted in their code, let's move on to the question of where to get the script. There are many services that can generate such a code in accordance with the needs of webmasters. Consider one of them.

There is a pretty nice solution called Share42 which allows both to just insert a horizontal bar in the article body or to hang vertical "floating" panel. In the second case buttons will be present on every page, and it will be discussed in the next article. Now we focus on the first version.

The series of articles which this afterword accomplishes does not claim the complete guide to migration of website on Joomla 1.5 to Joomla 2.5. It does not cover transfer of such powerful and popular tools like K2, components of forums, online stores, galleries and heaps of other extensions. The question of the multilingual site transfer was not broght up either. Many issues were considered rather superficially. On top of that this guide is outdated - as, indeed, any information instantly becomes obsolete in the rapid progress of digital technology. It is - on the one hand.

As usual at the beginning - the appeals for reading introduction and for not forgeting about backup!


Template

As we know, Joomla 1.5 uses templates based on table layout, which is now obsolete. Starting from 1.6 templates use the technology of div layout. Therefore, the installation of templates designed for 1.5 to newer versions is impossible by definition - they are just incompatible. Hence, there are several options:

In the first part we have hard, but worthy moved our menus, categories, articles and other content to the new site with preserving the structure. We now consider how to restore the customary set of extensions. Let's start with a separate examination of two very popular components. jDownloads and jComments are considered nearly the best each in its own sphere of application, a great many of Joomla users take advantage of them. In addition, both are free and have been translated into many languages. There is an obvious desire to transfer the entire set of comments and downloads to the new site. Detailed review of reliable and proven methods of migration jDownloads and jComments from Joomla 1.5 to Joomla 2.5 is the goal of this article.

Attention! Before you read this article and follow the instructions outlined therein, be sure to read the Introduction!


I took advantage of a known component jUpgrade. At that time, it was the latest version 2.5.2. I've been keeping to use it, although at the time of this writing, they have already released 3.0 PRO, radically different from 2.5.2. I tried it, but abandoned after a couple of failed attempts to run. Functionality of the previous one still suits me, at least for the options that I have used. Why I refused to transfer third-party extensions with the same utility, I tried to justify in the introduction. And the couple of bugs that came across on the road do not bother, if you know the easy ways to get around them. What is all about - it will be clear from the following description.

By working with this site, you agree to our use of cookies necessary to keep the settings you select, as well as for the normal operation of Google services.