Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7415623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:20:17+00:00 2026-05-29T07:20:17+00:00

i use a CMS (elgg : http://www.elgg.org ) working with view, equivalent to theme/template.

  • 0

i use a CMS (elgg : http://www.elgg.org ) working with view, equivalent to theme/template. To change the theme i have to put inside URL the term ?view=mytheme, like :

http://www.mydomain.com/index.php?view=mytheme

If i don’t add ?view=mytheme, elgg choose the view by default

So, i need help, for specific users, i want to redirect us to a custom view, and can’t see the default view.

I make this in my header :

<?php 

  if ((string) $_SESSION['user']->type === '2') {
    // ???
  } else {
    echo 'do nothing';
  }

I don’t know how to take the current url, and simple add ?view=mytheme at the end ?

When a user have the type ‘2’, and see the the url http://www.mydomain.com/index.php
it have to be forward to > http://www.mydomain.com/index.php?view=mytheme

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T07:20:17+00:00Added an answer on May 29, 2026 at 7:20 am

    This is kinda dirty, but you could:

    // Stole this from here: http://webcheatsheet.com/php/get_current_page_url.php
    function curPageURL() {
        $pageURL = 'http';
        if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
        $pageURL .= "://";
        if ($_SERVER["SERVER_PORT"] != "80") {
            $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
        } else {
            $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
        }
        return $pageURL;
    }
    
    $useCustomView = ((string)$_SESSION['user']->type) === '2';
    $usingCustomView = isset($_GET["view"]);
    // Redirect to custom view if user type is 2 and view is not already set
    if ($useCustomView && !$usingCustomView) {
            $newurl = curPageURL() . '?view=mytheme';
            header("Location: $newurl");
    }
    

    This is the most basic example I can think of to accomplish what you’re asking. This won’t quite do the job if you want the URL to support longer query strings so it needs some work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a couple of sites that use a bespoke CMS (e.g. www.trident-ha.org.uk). In
I'm working on a new CMS to use on repeative projects. Basically this chunk
I'm working on a custom CMS for my own use and was thinking about
I'm working on a project right now that required me to use a CMS
I have an existing CMS svn repository CMS_REPO. Now I want to use this
I have an application with a Java back-end. I wanted to use Drupal CMS
I have always wanted to make a small easy to use CMS system just
I'm working with an ASP.NET MVC site which will use a CMS controller for
I have a site which I have converted to use cms made simple. It
I have no experience with Drupal. I'm looking to use a cms but I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.