Segment Plugin Enhancement Request

Hi, would it be possible to add saved segment as an extra option in the select dropdown so that you can combine multiple segments together, e.g.
select … saved segment … Surname_A
select … saved segment … Surname_B

would generate a two part query where
email matches
email matches

In my opinion this would really make this plugin even better than it is!

@Geoff Just to clarify what you mean,

When you use a saved segment you would prefer the plugin to add its conditions to any already entered conditions instead of replacing any entered conditions.
That sounds do-able.

1 Like

Hi Duncan,
Thanks for the quick reply.

I think you have described my suggestion, but just to confirm - this is the approach I was thinking of…
Using this as an example…

This would then be saved using the Save segment button – as usual
Other ones would be set up in the same way.

When it comes to adding the segment settings for this campaign (and any future ones) I just want to be able to do…
Restart (clear all)
Saved Segment

This would bring up the same list as in the other dropdown (Use a saved segment. This will replace any conditions already entered.)
Adding tick boxes would be a real bonus as it would then allow multiple selections to be added in one visit to this dropdown

These would then be included within the existing section – as ADDITIONAL selection criteria
Subscribers match ANY of the following:
Select …

  9 subscribers will be selected 

would be equivalent to…
Subscribers match ANY of the following:
Email_address matches Calculate… 4 subscribers will be selected
Email_address matches Calculate… 5 subscribers will be selected
Select …

In theory, the current Use a saved segment (highlighted in blue above) would become redundant…
Please can you also confirm that the selection will automatically be refreshed from the full list of subscribers on the system each time the campaign actually runs via the schedule
It would also be very useful if the Segment details showed up in the View Campaign display.

Hopefully you received the missing images via the email I sent back to you.
Please let me know if you would like me to test any new versions of your Plugin that includes this feature.

@Geoff I don’t think that we are talking about the same change but it is hard to tell. What did you mean by

Using this as an example…

If there was only one change to be made, what would you want it to be?

For your other questions
The plugin selects the subscribers each time that processqueue is run.
If you view a single campaign then the segment criteria are displayed.

Yes - it is the same enhancement request !

There were supposed to be two images in the text I copied in, but they did not appear in the forum when I pasted it. Didn’t spot the upload file option

Hopefully, you have enough to fill in the gaps now

PS. I have just tried processing the queue for a campaign with segments, and got the message above … it says it has finished the run, but it doesn’t stop processing - any idea why

Sounds like there are two subscribers remaining, both are rejected for sending by the plugin, but phplist doesn’t realise that the whole campaign is then finished.
You will need to suspend the campaign, and manually mark it as sent.

Your explanation is still a bit complicated for me.
If the current processing of using a saved segment that replaces existing conditions was changed to add to existing conditions, would that be useful? You could then sequentially add several saved segments.

Possibly change the selection of a saved segment to be multi-select, but that needs more investigation.

Hi Duncan,
That is correct, just 3 subscribers in the test list, one selected for emailing using a segment.(Surname_F to pick out my email address)

I think I know how to do that as a one off, but I would not want to do that operationally every time. What needs to be done to make it work correctly?
Most of the other posts I have seen appear to say that it all works ok for them.

Is this something that running via cron would overcome?
Does this need to be raised as a known issue with the latest version of phplist?
Are you aware of anyone having problems using this plugin with a bitnami installation?


Hi Duncan,

You could then sequentially add several saved segments

That is exactly what I am looking to do. I will no doubt end up with more segments to choose between as the ones I have given here are just a few simple test examples.

The only reason for suggesting some sort of radio button for each segment would be to avoid sequentially adding many segments, for example selecting a subset of the Wards that we have within the council, or possibly even down to PostArea level.

Your suggestion of extending the scope for a segment definition to include multiple criteria selections and other SQL matching options like LT,LE,GT,GE, IN or NOT IN would be good too.

Would it be possible to add subgrouping so that you can hide the saved segments and then view the segments within that subgroup (e.g. Ward, District, PostArea, Email_AtoZ) ?

And finally, as the list of segments can be seen in Settings, does that mean that the segment definitions are actually held in a phplist database table or somewhere else?


I can repeat the problem quite simply so it is a bug in the core phplist code. It is not something that I can fix in the plugin.
You can raise the problem on Mantis but you will need to register first as it is separate to this forum.

What is the relevance of bitnami?

Hi Duncan,
How many of these new features do you think are realistically do-able?
What timescale do you give for making changes like this?

Thanks again for considering these enhancements.


@Geoff I’m looking at some changes to the processing of saved segments, as I think that they will be generally useful.

  • able to select more than one saved segment from the drop-down list
  • the conditions of the saved segment are added to existing entered conditions, instead of replacing them (this is probably the way I should have made it originally)
  • a button to remove all entered conditions

I should have a new release shortly.

@Geoff There is a new release of the plugin with the changes I mentioned above. You can upgrade on the Manage Plugins page within phplist.

Hi Duncan,
I have updated the plugin, and it all works just as you described.

A couple of points

  • can you remove the double spacing in the list of saved segments list
  • adding segment grouping (e.g… AtoZ, Company, Wards) would be really great
  • is it possible to do… text_attribute in [one, two, three, four]

Something that I suggested earlier was to have just the saved segment names added to the conditions list rather than expanding these into the corresponding selection criteria.
This would allow any changes made to saved segments to be applied at run time, and hence we would not need to go through any saved campaigns in order to re-apply these changes. Please can you look into whether this can be done

I also noticed it said that it ignores subscribers that have already been emailed - which is what you want for an existing campaign that has run…
However, I would not expect that to be the case when a completed campaign is edited, and put back into the Draft campaigns. In this situation I would want the whole list to be available again.

Do you know if there Is any reason why the subscriber list and segment details cannot be copied into the new campaign using the plugin Manage campaigns?

As a separate issue - could your Segment plugin logic be used within the definition of a list itself, so that sub lists can be created directly by selecting an existing list and selection criteria?

@Geoff Sorry but you are raising too many issues at once. Just a couple of comments:

if you send the same campaign again by editing it then resubmitting, then phplist will send only to people who have not already received it. If you want to send to the full set of subscribers then you need to create a new campaign.

text_attribute in [one, two, three, four] - this can be achieved using the REGEXP operator with a target value of ^(one|two|three|four)$

Thank you Duncan for the clarification.
If this is the case, then the ability to copy the segment details across to a new campaign using the plugin Campaign manager becomes even more relevant.

The other option might be to be allow a saved segment to have multiple criteria selections. Something that you have mentioned may be possible.

It also looks like I may need to do some more homework regarding REGEXP :slight_smile:

I am sorry if I appear to be too demanding, but my users are even more so!
We have not fully gone live with phpList yet, and we are trying to convince them that Campaign Manager (with all it’s bells and whistles - but costly) can be replaced by this comparatively modest but freeware application.
I am sure the council should be able to justify some form of funding if the savings proposed can be justified.

Thank you for helping with my pursuit of making your plugins even better for us!

I’m not sure what you mean by this, so I cannot have mentioned that it may be possible.

It sounds like you want personal support in using phplist. We need to deal with that privately, so send me a personal message if you want to do that.

Hi Duncan, I have been relooking at the segment plugin changes.
One thing I hadn’t noticed is that multiple saved segments can be added in one go, although in a slightly different way from how I expected. This certainly does make it easier.

I would still prefer the double spacing to be removed - to save scrolling down!
Would it possible to select all the ones you want in one pass of the list (highlight them) ?

You stated earlier (24th Jan) …

Possibly change the selection of a saved segment to be multi-select, but that needs more investigation

It appears that a saved segment can already be defined to do this, but not the ALL/ANY (I.e. AND/OR logic)
If two or more segments are selected, the ALL/ANY logic set when the segment definitions were saved no longer applies. This makes the logic no longer correct.

I stated (23rd Jan) …

Subscribers match ANY of the following:
Select …

I.e. segments these would be included using their name, as opposed to their criteria being expanding on the fly.

The reasons for suggesting this had many benefits…
… a saved segment definition can be modified on the fly without changing campaigns
… each segment would effectively be self contained, and therefore calculated separately
… ANDs could be used inside a segment, and ORs used to join them (or vice-versa)

I am certain that these changes would benefit everyone who uses your plugin.

That is how it works, it is a multi-select list. Or am I misunderstanding what you mean? The vertical spacing isn’t deliberate, it is just how it came out.

I now see what you might mean. You can use ctrl-click to select an item and keep the list open.

Hi Duncan
Thanks for the update - once you said I should be able to do it, I tried that and it works fine. Makes the spacing less of an issue too as it remembers where you were.

Theoretically we could end up with 100s of saved segments, so subgrouping the list would be a real bonus to me, as this would allow hiding the segments I am not interested in selecting


Hi Duncan, it would be very useful if we were able to see the list of emails that is generated when you click Calculate rather than just showing how many there would be.

Could an option to copy these to a different subscriber list be included?
This would enable multiple saved segments to be added together into one list.

This new subscriber list can then be selected to be used prior to submitting the campaign.
I do realise it would mean the list becomes static. In most cases that would not be an issue.

However, this would allow the scheduled campaign processing stage to run far more quickly as the unwanted emails from the original large list would no longer need to be skipped!


Whether the generation of a pseudo list could be created on the fly when the scheduled campaign using segments is processed is another matter - that may be an even better solution.