XenPorta 2 for XenForo 2 to be released on New Years!

How do I go about getting this one for XF 2.x when I purchased the original (with Branding Removal) when XF 1.0 didn't have the Resources addon?
 
How do I go about getting this one for XF 2.x when I purchased the original (with Branding Removal) when XF 1.0 didn't have the Resources addon?
The resource addon has nothing to do with anything.

XF2 version will not be free with the XF1 version.
 
The resource addon has nothing to do with anything.

XF2 version will not be free with the XF1 version.

Thanks, so would the Branding Removal transfer over or would I need to buy both again?
 
A couple of features you may notice are missing from from this new version... As usual, with every rewrite, I tend to remove features that got added in over time through feature creep.
  • Article category filtering
Right now, XenForo 2's built in finder system doesn't support `TO_MANY` relations. As such, the `GROUP BY` MySQL function isn't available. I know I can write my own queries, but the XF2 finder system is just way too convenient not to use... so I'll be waiting for the `TO_MANY` relation before this feature comes back.
  • Custom user arrangements of the home page
We no longer use our own widget system... instead we use the built in XenForo 2 widget system. Its easier to use, its a unified system, and every addon developer understands it. So in the move to be more in line with the rest of the addon community, we're abandoning our bespoke system. Unfortunately, some of the more unique features of our system will be lost in the process, as you can not do them in the XenForo 2 system.
  • Custom user disabling of the feature slider / infinite scrolling
The new infinite scrolling system is a TON better than the old one. No real reason for this feature to exist anymore... and the disabling the feature slider on an individual basis just wasn't a much used feature.
  • Disqus and Facebook integration
So few people actually used this feature. Anyone who did want to use these features, instead of using the built in forum (for which they paid $150+), is probably knowledgeable enough to simply use template modification system to replace the built in comments system with their custom integrations.
 
A couple of features you may notice are missing from from this new version... As usual, with every rewrite, I tend to remove features that got added in over time through feature creep.
  • Article category filtering
Right now, XenForo 2's built in finder system doesn't support `TO_MANY` relations. As such, the `GROUP BY` MySQL function isn't available. I know I can write my own queries, but the XF2 finder system is just way too convenient not to use... so I'll be waiting for the `TO_MANY` relation before this feature comes back.
I may be able to help with this, I've written some advanced finder expressions (example: https://xenforo.com/community/threads/order-by-phrase.139717/#post-1205984) and I've also some experience using the Searcher system (separate from the search index, mind) in order to create advanced filtering options.

If you want, feel free to re-add the feature to the templates / code, leaving the TO_MANY relation intact and send me a copy. If you tell me how to access the page that complains about TO_MANY relations, I may be able to trick it into working.

If you'd rather not, the best advice I can give you is this: $finder->with('ArticleCategories|' . $categoryId);
If you have a relation "ArticleCategories" that joins on TO_MANY, using the | key in the specification will allow you to join on a single value from the relation. You can then use that in a where condition.

Full working example (taken from my License Field searcher, pretty much the same method that allows you to search custom user fields in XF2):

PHP:
protected function applySpecialCriteriaValue(Finder $finder, $key, $value, $column, $format, $relation)
    {
        if ($key == 'license_fields')
        {
            $exactMatchFields = !empty($value['exact']) ? $value['exact'] : [];
            $customFields = array_merge($value, $exactMatchFields);
            unset($customFields['exact']);

            $conditions = [];
            foreach ($customFields AS $fieldId => $value)
            {
                if ($value === '' || (is_array($value) && !$value))
                {
                    continue;
                }

                $finder->with('LicenseFields|' . $fieldId);
                $isExact = !empty($exactMatchFields[$fieldId]);

                foreach ((array)$value AS $possible)
                {
                    $columnName = 'LicenseFields|' . $fieldId . '.field_value';
                    if ($isExact)
                    {
                        $conditions[] = [$columnName, '=', $possible];
                    }
                    else
                    {
                        $conditions[] = [$columnName, 'LIKE', $finder->escapeLike($possible, '%?%')];
                    }
                }
            }
            if ($conditions)
            {
                $finder->where($conditions);
            }

            return true;
        }

        return false;
    }


Fillip
 
Specifically, I would be looking to do:
Code:
->with('CatLink')->where('CatLink.category_id', '!=', ['2','6'])
Exception: Joins only support TO_ONE relationships currently in src/XF/Mvc/Entity/Finder.php at line 651

A group by is important for this, because when paginating, it can pick up a catlink an additional time, since they are not grouped.
 
Last edited:
Specifically, I would be looking to do:
Code:
->with('CatLink')->where('CatLink.category_id', '!=', ['2','6'])


A group by is important for this, because when paginating, it can pick up a catlink an additional time, since they are not grouped.
Is a CatLink just a bridge between articles and categories (like a relation map), or does it actually contain any data?


Fillip
 
The way I wrote it in XF1:

Code:
SELECT articles.*
FROM articles
    LEFT JOIN catlinks ON (catlinks.thread_id = articles.thread_id)
WHERE
    catlinks.category_id NOT IN (" . $this->_getDb()->quote($filterOut) . ")
GROUP BY articles.thread_id

I dont even need TO_MANY... I just need a group by.
 
The way I wrote it in XF1:

Code:
SELECT articles.*
FROM articles
    LEFT JOIN catlinks ON (catlinks.thread_id = articles.thread_id)
WHERE
    catlinks.category_id NOT IN (" . $this->_getDb()->quote($filterOut) . ")
GROUP BY articles.thread_id

I dont even need TO_MANY... I just need a group by.
So I tried, I really did, but I ended up cheating:

PHP:
        $finder = $this->finder('EWR\XenPorta:Article');
        $map = $finder->getHydrationMap();
        
        $results = $this->app()->db()->query("
            SELECT articles.*
            FROM articles
            LEFT JOIN catlinks ON (catlinks.thread_id = articles.thread_id)
            WHERE catlinks.category_id NOT IN (" . $this->app->db()->quote($filterOut) . ")
            GROUP BY articles.field_id
        ");
        
        while ($row = $results->fetchAliasGrouped())
        {
            $entity = $this->em()->hydrateFromGrouped($row, $map);
            $id = $entity->getIdentifier();
            
            if ($id !== null)
            {
                $output[$id] = $entity;
            }
            else
            {
                $output[] = $entity;
            }
        }
        
        $articles = $this->em()->getBasicCollection($output);


Fillip
 
Seems like a lot of work for something which should be as simple as ->group('thread_id')...

With the above code, could I still use the entity system?
 
Seems like a lot of work for something which should be as simple as ->group('thread_id')...

With the above code, could I still use the entity system?
Well yes, as you can see there are multiple references to "entity" in the code :P

"hydrate" is XF2's way of filling an entity with values from the DB, so when you hydrate an empty entity you get the full thing.


Fillip
 
Okay, that code would require me to rewrite way too much of my other code. Not worth the effort.
 
What's upgraded when you upgrade?

We used XP1 as a portal but I don't think there's really much that would need to be carried over with an upgrade. Our articles were all just pulled from a forum and I can't think of anything else.

Wondering if a fresh install makes sense or does the upgrade deal with any old tables etc that aren't needed?
 
What's upgraded when you upgrade?

We used XP1 as a portal but I don't think there's really much that would need to be carried over with an upgrade. Our articles were all just pulled from a forum and I can't think of anything else.

Wondering if a fresh install makes sense or does the upgrade deal with any old tables etc that aren't needed?
There is no difference between an upgrade and a fresh install. They are both exactly the same. You can however use the importer after the fact, to import the tables from the old install to the new version.
 
Top Bottom